excel - Assigning String a value from another workbook -


I am trying to designate a value from a cell in a string in another code in any other workbook.

So currently my code will look at the column P, G, H, I in the workbook, but I have created another workbook which requires all the columns to see me. On the second workbook I used to map it So the site ID value is shipped, but I can exercise how to specify a value in this code below code from this workbook.

I want this to change the value in my mapping workbook instead of just having to change it instead of coming back to my coding and changing the column letter.

  ShipToSiteID = Application.WorksheetFunction.Trim (range ("P" Alt); 1) Application. Worksheet Function. RIM (Range ("G" and Counter)) AltShipTo2 = Application. Worksheet Function. RIM (Range ("H" and Counter)) AltShipToCity = Application.WorksheetFunction.Trim (Category) ("I" and Counter))  

when you use the range" p "and counter) this ActiveWorksheet

, So it is ActiveWorksheet.Range ("P" & Counter)

If you want to refer to any other workbook, you will find one within this workbook Sheet.

sub-testing () Dim newWorkbook as a new workbook worksheet in the form of workbook 'NewWorkbook.xlsm is already open NewWorkbook = Set up workbooks (set to "NewWorkbook.xlsm") NewWorksheet = set newWorkBook worksheets ("Sheet 1") MSBBC "This value is A1 in the new workbook -" & amp; Price end sub

You can also get an open workbook by index (though it is not really recommended).

  workbook You can get and open the workbook at the same time by using Open  

> New Workbook = Set Workbooks (1)  

< Get started using Code> Set NewWorkbook = Workbooks.Open ("C: / path / to / workbook")

or Workbook.Add

  Set NewWorkbook = Workbooks.Add ()  

In addition to this, use your application. Worksheet function.trim

A VBA trim () functions has been improved which would be better ..


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -