Slight adjustment needed for Macro

  • Thread starter Thread starter Bob Vance
  • Start date Start date
B

Bob Vance

This Macro lets me copy down every 72 cells till 5112, But it does not copy
the font or size, can I adjust it to copy everthing in the cell,

Public Sub CopySelectionEvery72UntilRow5112()
Dim i As Long
With Selection(1)
For i = .Row + 72 To 5112 Step 72
Cells(i, .Column).Value = .Value
Next i
End With
End Sub


Thanks in advance for your help....Bob Vance
 
Bob said:
This Macro lets me copy down every 72 cells till 5112, But it does not copy
the font or size, can I adjust it to copy everthing in the cell,

Public Sub CopySelectionEvery72UntilRow5112()
Dim i As Long
With Selection(1)
For i = .Row + 72 To 5112 Step 72
Cells(i, .Column).Value = .Value
Next i
End With
End Sub


Thanks in advance for your help....Bob Vance
(the following is untested but relatively straightforward)
to copy the font and size along with value put:
Cells(i, .Column).Value = .Value
Cells(i, .Column).font.size = .font.size
Cells(i, .Column).font.fontstyle = .font.fontstyle
into the for-next loop

to copy 'everything' put this in the for-next:
Selection(1).copy Cells(i, .Column)

and then you might want to add just before the End Sub:
Application.CutCopyMode = False

Hope this helps,

Matthew
 
--
Brilliant, Mr McGimpsey thanx for the help :)


Thanks in advance for your help....Bob Vance
 
Back
Top