I have a small sub routine below I would like to make a slight modification to. The routine currently references formatting relative to the Offset statement in bold below. Instead, I would like the formatting to come from a cell address listed in a cell just to the left of the cursor when the statement is encountered. Can anyone help? Thank you.
Sub ()
Dim lR As Long, col As Range, c As Range
lR = Cells(Rows.Count, Selection.Column).End(xlUp).Row
Application.ScreenUpdating = False
For Each c In Range(Cells(Selection.Row, Selection.Column), Cells(lR, Selection.Column))
If Not IsEmpty(c) Then
On Error Resume Next
Set col = Offset(0, -c.Offset(0, 1).Value) '(WANT TO CHANGE TO THE CELL ADDRESS WHICH WILL BE FOUND IN THE CELL TO THE LEFT OF THE CURSOR WHEN THIS STATEMENT IS ENCOUNTERED)
col.Copy
c.PasteSpecial xlPasteFormats
End If
Next c
Calculate
End Sub
Moderator's Note: Moved from General forum --6SJ
Bookmarks