Quick questions. I've looked around and still am in the process but I'm not finding the answer easily so I thought I would post the question also.
I need to update an Excel file from the contents of another Excel file.
Both Excel files contain only one worksheet but the names of the sheets are different and not sheet1,sheet2 etc..
I know you can reference the sheet by index so that is not a question. Basically I need to run down the contents of say column B in workbook1.sheet1 and find a valid numeric (currency in this case) value. If I find one I then need to grab the value on that row in column A which holds the material number. That number is then what I need to attempt to match in workbook2.sheet1 in column A. If I iterate through column A in workbook2.sheet1 and find a material number matching I must take the value in column B of workbook2.sheet1 and update workbook1.sheet1 column B which was the first numeric value I found. *sigh* hopefully all the this1, that2, this2, this1 made sense.
I know how to open workbooks via Workbooks.Open but sense I need multiple workbooks open at once would I then do a
?
second question is I see a number of forms of looping through columns but the one sheet I have a problem with is the first one which has many empty cells in the mix of the data I need to update. Are there functions (IsEmtpy) etc.. that will assist me in navigating through these without going into a wild script due to end of file issues. I'm not sure how Excel deals with the last cell or is there a last cell?
I guess I'm asking for some assistance in putting together the methods I should use and more so the functions available to me to get this task done quicker pretty much without spending hours reading up on VBA references. This is probably going to be a one time deal and my VB6 is rusty and I've never touched VBA code.
Thanks for the assistance!
____________ signature below ______________
General FAQ faq333-2924
5 steps to asking a question faq333-3811
I need to update an Excel file from the contents of another Excel file.
Both Excel files contain only one worksheet but the names of the sheets are different and not sheet1,sheet2 etc..
I know you can reference the sheet by index so that is not a question. Basically I need to run down the contents of say column B in workbook1.sheet1 and find a valid numeric (currency in this case) value. If I find one I then need to grab the value on that row in column A which holds the material number. That number is then what I need to attempt to match in workbook2.sheet1 in column A. If I iterate through column A in workbook2.sheet1 and find a material number matching I must take the value in column B of workbook2.sheet1 and update workbook1.sheet1 column B which was the first numeric value I found. *sigh* hopefully all the this1, that2, this2, this1 made sense.
I know how to open workbooks via Workbooks.Open but sense I need multiple workbooks open at once would I then do a
Code:
Set workbook1 = Workbooks("Excel1.xls")
second question is I see a number of forms of looping through columns but the one sheet I have a problem with is the first one which has many empty cells in the mix of the data I need to update. Are there functions (IsEmtpy) etc.. that will assist me in navigating through these without going into a wild script due to end of file issues. I'm not sure how Excel deals with the last cell or is there a last cell?
I guess I'm asking for some assistance in putting together the methods I should use and more so the functions available to me to get this task done quicker pretty much without spending hours reading up on VBA references. This is probably going to be a one time deal and my VB6 is rusty and I've never touched VBA code.
Thanks for the assistance!
____________ signature below ______________
General FAQ faq333-2924
5 steps to asking a question faq333-3811