Basically I'm grabbing data from a workbook someones sends, looping through all the worksheets within the workbook, and pasting the data to a master workbook in a database format so I can upload to SQL. Also the worksheets that I get sent are not always the same name each time they are sent.
I've used 'For Each ws In ActiveWorkbook.Worksheets' before, but only when doing something to one workbook and not referencing any other ones. Apparently when I'm using that loop now, everything runs correctly but it's only grabbing data from the first worksheet, and not moving to the rest.
e.g. If I have 10 worksheets it'll loop through 10 times, grab the correct data, but it will be the data from only the first worksheet pasted 10 times.
Here is the basic code, basically I was hoping there was some type of reference I could use to store the name of the current worksheet into a value at the beginning of each loop, so I could reference it using Sheets(name).Select. I tried ws.Name and ActiveSheet.Name but those didn't seem to work.
So all the actual code works, it's not too complicated. But I can't seem to get it to move to the next worksheet. It will just keep grabbing the same data from the first worksheet until the loop finishes.Please Login or Register to view this content.
Thanks.
Bookmarks