-2

I need to copy a column of data to another column on a different worksheet, pasting values only. The appropriate paste column is identified in a single cell. This cell will be changed manually each time the macro is applied. So one time I might want to copy/paste in the first column, so my identifier cell is 1. The next time I might input 5 in this cell so that I offset 5 columns to the right to copy/paste data. Thank you.

Lance U. Matthews
  • 15,725
  • 6
  • 48
  • 68

1 Answers1

0

You can reference the columns in a worksheet using the Columns property. You can achieve what I think you're trying to do with code like this.

Dim col As Integer

col = SomeSheet.Cells(1,1).Value
FromSheet.Columns(col).copy
ToSheet.Columns(col).PasteSpecial xlPasteValues
Nicholas Hunter
  • 1,791
  • 1
  • 11
  • 14