Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting Info To Different Workbook In Excel

Status
Not open for further replies.

SandraF

Programmer
Jan 25, 2001
28
0
0
US
The problem I am having is exporting information from one workbook to another workbook in excel. The way I have it set up now is using a macro. The macro is in the workbook that I get the information from, and opens the workbook that I want to put the information into. The code below works fine until I get to the while statement. It recognizes that ws is meant for the active worksheet (the one where the macro is located in and where I am getting the information from) becasue it checks the sheets correctly in the case statement before it. I also make sure that there is data in the field where it checks in the while loop.

Set wbMaster = ThisWorkbook 'WORKBOOK WHERE THIS MACRO IS LOCATED

'OPENS UP THE OTHER WORKBOOK FILE TO GET THE INVOICE DATA FROM IT
Workbooks.Open "E:\DBTest.xls"
Set wbTemp = ActiveWorkbook

For Each ws In Worksheets
Select Case ws.Name
Case "LOG", "Summary"
'DO NOTHING - DONT WANT THAT INFORMATION
Case Else 'GET INVOICE ROWS
'DO AS LONG AS THERE IS DATA IN THE CELL
Do While Len(ws.Range("C" & iRow).Text) > 0
wbTemp.Sheets("DB").Cells(Counters, 1).Value = wbMaster.Sheets("CONTRACT BRIEF").Cells(3, 2).Value

The Db is in the workbook that I am exporting data into, and the Contract Brief is in the workbook that the macro is in.

Any help would be apprieciated! THANKS!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top