Hello. I have data with A1:B2 and that's it. Why isn't this code capturing that?
Thanks.Please Login or Register to view this content.
Hello. I have data with A1:B2 and that's it. Why isn't this code capturing that?
Thanks.Please Login or Register to view this content.
Are you trying to select, copy or both, A1 and B2? Your code is set to select/copy A1 and B1.
1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.
Tom
What do you mean? It's supposed to capture the last row in B, which is B2, so the range should be A1 to B2. Below is complete code.
Please Login or Register to view this content.
You are right, I didn't have anything in cell B2 so it didn't select it, once I did put a value in B2, the copy part of the code worked. However, I couldn't get the Paste part of the code to work until I changed Sheets(s + 1) to Sheets("Sheet2"). I'm guessing I'm missing something with the s + 1 part.
I changed it to sheet2 as well and it still doesn't work. It just copies the first row from income statement twice. The s+1 just creates a new sheet.
When using the Cells property you need to also reference the sheet. A lack of a reference indicates the Activesheet which may or may not be correct.
Note: The s+1 does not create a new sheet unless you are acutally creating a new sheet in code we cannot see.Please Login or Register to view this content.
If you are happy with my response please click the * in the lower left of my post.
I tried using this and I also got an error. @ stinky, I'll try your code in a second.
@ stinky, your code works. How could I do it with two ranges instead of that last cell piece?
I am not sure I understand what you mean. Do you mean like this?How could I do it with two ranges instead of that last cell piece?
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks