Hi everyone,
I am new to VBA and trying to improve the way I write code because I currently use a combination of recording macro and some other things that I learnt and would like to be more efficient.
I have the following code but it is not working as intended.
Instead of getting the value in the mentioned cells, the word address is repeated in the mentioned cells.
I was also wondering if there is a way to select multiple sheets at the same time and apply the same command to all of them.
The example below does not work
I would appreciate any help/advice.
Thanks in advance
Ellie
I am new to VBA and trying to improve the way I write code because I currently use a combination of recording macro and some other things that I learnt and would like to be more efficient.
I have the following code but it is not working as intended.
VBA Code:
Sheets("Main").Select
Range("B2:B2, G2:G2, H2:H2").Value = Array("Address", "City", "Country")
Range("B2:B2, G2:G2, H2:H2").Select
With Selection.Font
.Color = -16776961
.TintAndShade = 0
End With
Range("B:B, G:G, H:H").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Instead of getting the value in the mentioned cells, the word address is repeated in the mentioned cells.
I was also wondering if there is a way to select multiple sheets at the same time and apply the same command to all of them.
The example below does not work
VBA Code:
Sheets("Main","Report","Data").Select
Rows("2:2").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
I would appreciate any help/advice.
Thanks in advance
Ellie