I am a Maths Teacher and I have been trying to teach myself to write vba code and macros in order to make small maths puzzles for my students in lessons. I apologise for my very basic skills in vba but I hope you will help anyway.
I am trying to write a vba code that IF cells in a range (C4:I9) have no fill (x1None) AND the text content in these cells (only those which have no fill) does not match any other cell (which has no fill) to fill that cell with a certain colour.
Here is what I have tried but to no avail:
Sub Undo()
'
' Undo Macro
'
'
Range("C4:I9").Select
If cell.Interior = x1None And strcmp(C4, I9, vbTextCompare) = 0 Then
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.399975585192419
.PatternTintAndShade = 0
End With
ActiveSheet.Range("IV65536").Select
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 1
Else
' do nothing
End If
End Sub
I know I am way off with the If And statement, but bear with me I am very very new to all this!
Hope someone can help.
Thanks
I am trying to write a vba code that IF cells in a range (C4:I9) have no fill (x1None) AND the text content in these cells (only those which have no fill) does not match any other cell (which has no fill) to fill that cell with a certain colour.
Here is what I have tried but to no avail:
Sub Undo()
'
' Undo Macro
'
'
Range("C4:I9").Select
If cell.Interior = x1None And strcmp(C4, I9, vbTextCompare) = 0 Then
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.399975585192419
.PatternTintAndShade = 0
End With
ActiveSheet.Range("IV65536").Select
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 1
Else
' do nothing
End If
End Sub
I know I am way off with the If And statement, but bear with me I am very very new to all this!
Hope someone can help.
Thanks