Hi,
I have created VBA to action my spreadsheet, but I'm lost on how to change a cell colour e.g. cell "O35" to be same colour as cell "N35". It keeps telling error, can anyone help me finish this coding.
Sorry but I don't know how to upload the spreadsheet for you to play with.
I have created VBA to action my spreadsheet, but I'm lost on how to change a cell colour e.g. cell "O35" to be same colour as cell "N35". It keeps telling error, can anyone help me finish this coding.
Sorry but I don't know how to upload the spreadsheet for you to play with.
VBA Code:
Private Sub Rollovertest_Click()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Sheet2.Cells(Rows.Count, "B").End(xlUp).Row
With Sheet2
For i = 1 To Lastrow
Select Case .Cells(i, 3).Value
Case "S", "V": .Cells(i, "AB").Copy: .Cells(i, "AC").PasteSpecial xlPasteValues
End Select
Next
End With
Dim vR As Long, vN As Long
With Sheet2
vR = .Columns(1).Find("*", , , , , xlPrevious).Row
For vN = vR To 2 Step -1
If .Cells(vN, "O").Value = Range("AH1") Then
vN2 = vN + 1
.Rows(vN2).Insert
.Range(Cells(vN, 1), Cells(vN, "AG")).Copy .Range("A" & vN2)
.Cells(vN2, "F") = Cells(vN, "F") + 0.01
.Range("AI1:AJ1").Copy Range(.Cells(vN2, "N"), Cells(vN2, "O"))
.Range(.Cells(vN2, "T"), Cells(vN2, "V")) = ""
With .Range(.Cells(vN2, "T"), Cells(vN2, "V")).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.599993896298105
.PatternTintAndShade = 0
End With
.Range("AC" & vN2) = 0
.Range("AC" & vN2).NumberFormat = _
"_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)"
End If
Next vN
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub