Selecting and copying a dynamic range of cells
I am not sure if this is exactly what you want... It is a little odd but it
is exactly what you asked for...
Public Sub CopyHeaders()
Dim rngToCopy As Range
Dim wks As Worksheet
Set wks = ActiveSheet
Set rngToCopy = Range(wks.Range("A1"), wks.Range("IV1").End(xlToLeft))
rngToCopy.Copy wks.Range("B1")
End Sub
If all you are trying to do is to shift your headings one cell to the left
then it is a lot easier than Copying and Pasting. Just insert a cell similar
to this
Public Sub ShiftHeaders()
ActiveSheet.Range("A1").Insert xlToRight
End Sub
--
HTH...
Jim Thomlinson
"EstherJ" wrote:
I need to select and copy a row of headers in a spreadsheet starting from A1.
The number of columns with headers is not always the same. I would like to
paste them alongside the original headers but offset by one column.
Thank you for you help,
Esther
|