I would appreciate some guidance on how to center across selection by referencing cell values in worksheet "Data" whilst copy/pasting another value from the same worksheet.
Column A | Column B | Column C |
---|---|---|
January-22 | F1 | I1 |
February-22 | J1 | M1 |
March-22 | N1 | R1 |
April-22 | S1 | V1 |
I would like to copy the values from column A, paste them to the cell referenced in column B (in Worksheet "Overview"), and center across the selection referenced in columns B and C
Sub months()
Dim i As Integer
Dim Cval As Variant
Dim Rng1 As Range
i = 1
Cval = Worksheets("Data").Range("B" & i).Value
Set Rng1 = Worksheets("Overview").Range(Cval)
With Worksheets("Data").Range("A" & i).Copy
Worksheets("Overview").Activate
Rng1.Select
ActiveSheet.Paste
Range("F1:I1").Select
Application.CutCopyMode = False
End With
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.MergeCells = False
End With
End Sub
Thank you in advance for anybody that can help.