Hi,
I have written some code to export queries from access into excel and then apply some formatting.
Now this works perfectly fine but I know it isn't quite good practice.
In the first with ws1 section I understand that the lastrow = ...part works because it is in the currently active sheet. And then later down I have had to put some formatting into the If intcurrent = 2 and If intcurrent = 3 sections because I get an error if I bring them up under the with ws2 and with ws3 sections and use the lastrow reference again because, one it is referencing the first sheet, and 2 because there is no object properly set.
So my question is how can I neaten this up and what is the code for properly setting references to the ranges. Ideally i'd define the range Range("A1").End(xlDown).Row for each worksheet.
Thanks in advance!
Bookmarks