Troubleshooting copy and paste code

Copper Contributor

Hi All, I need some help with this code. I am trying to copy data from File A to last column in File B. The code works if I replaced last code (Circled in red) to a specific cell (e.g. "IY12") but stop working when I replaced it with variable column.. Am I defining the variable incorrectly?

 

peysg_0-1653473700359.png

 

 

 

 

 

 

1 Reply

@peysg 

lDestLastColumn is a number, but Range expects a column letter.

Change wsDest.Range(lDestLastColumn & "4") to wsDest.Cells(4, lDestLastColumn)