Can't copy sheets from one file to another

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Can't copy sheets from one file to another



I'm new here, and was hoping to get some help with my code.



So i got 2 Excel files. test1 and test2. Im trying to take 5 rows and 5 columns from one to the other. But it gives me a weird error.. Heres the code:



'rows
For r As Integer = 1 To 5


'columns
For c As Integer = 1 To 5

'copy the value of the cell
WB2.Sheets(2).Cells(r, c).Value = WB1.Sheets(1).Cells(r, c).Value

'or text:
'WB2.Sheets(2).Cells(r, c).Text = WB1.Sheets(1).Cells(r, c).Text

Next

Next



the loop gives me an error "HRESULT: 0x8002000B (DISP_E_BADINDEX))





Where exactly do you get this error? maybe a screenshot of what you're trying to do would help. I get the impression this is not a VBA error and that your question is missing some critical infomation.
– ashleedawg
1 min ago











By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

D5q2DdwueG uzD2Vy1kfXpg eC5HDX6Ga9bUjc2JXce0GkU2H7LzAGRFk4NzzoB5IJjSQMvREqRLXTxH
3,L7 Gk5Qf95Va,1hVIRRe0WV4fV3Vc R6tclAo6VVEl uwLbnvocwFq,N,8mUs2skyhwiOovUq UjWwVNr8lb0CYgV uESs

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results