ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   select multiple cells (https://www.excelbanter.com/excel-programming/313173-select-multiple-cells.html)

Mestrella31

select multiple cells
 
Good morning from Mexico.
I need help on this Macro.
I am comapring one in sheet 1 the other in sheet 2
if this are diferant I need them to change the font color & background of
the two cells.

this is what I have but can't , this changes the color in one of the cell
but the other does not change

Sub crosscheck()

'Dim crosscheck As Double
'crosscheck worksheets for out of balance shedules

dblCheck = Abs(Sheets("AvgPrice NA").Range("d17").Value -
Sheets("SalesAnalysis NAGDO").Range("d90").Value)
If dblCheck 0 Then
Sheets("AvgPrice NA").Select
Range("d17").Activate
Sheets("SalesAnalysis NAGDO").Select
Range("d90").Activate
With Selection.Font
.ColorIndex = 3
End With
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With


End If


End Sub


Tom Ogilvy

select multiple cells
 

'Dim crosscheck As Double
'crosscheck worksheets for out of balance shedules

dblCheck = Abs(Sheets("AvgPrice NA").Range("d17").Value -
Sheets("SalesAnalysis NAGDO").Range("d90").Value)
If dblCheck 0 Then
Sheets("AvgPrice NA").Select
Range("d17").Activate
Sheets("SalesAnalysis NAGDO").Select
With Selection.Font
.ColorIndex = 3
End With
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With

Range("d90").Activate
With Selection.Font
.ColorIndex = 3
End With
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With


End If
End Sub

--
Regards,
Tom Ogilvy



Bob Phillips[_6_]

select multiple cells
 
Sub crosscheck()

'Dim crosscheck As Double
'crosscheck worksheets for out of balance shedules

dblCheck = Abs(Sheets("AvgPrice NA").Range("d17").Value -
Sheets("SalesAnalysis NAGDO").Range("d90").Value)
If dblCheck 0 Then
with Sheets("AvgPrice NA").Range("d17")
.Font .ColorIndex = 3
.Interior.ColorIndex = 15
.Interior.Pattern = xlSolid
End With

WithSheets("SalesAnalysis NAGDO").Range("d90")

.Font .ColorIndex = 3
.Interior.ColorIndex = 15
.Interior.Pattern = xlSolid
End With

End If


End Sub


--

HTH

RP

"Mestrella31" wrote in message
...
Good morning from Mexico.
I need help on this Macro.
I am comapring one in sheet 1 the other in sheet 2
if this are diferant I need them to change the font color & background of
the two cells.

this is what I have but can't , this changes the color in one of the cell
but the other does not change

Sub crosscheck()

'Dim crosscheck As Double
'crosscheck worksheets for out of balance shedules

dblCheck = Abs(Sheets("AvgPrice NA").Range("d17").Value -
Sheets("SalesAnalysis NAGDO").Range("d90").Value)
If dblCheck 0 Then
Sheets("AvgPrice NA").Select
Range("d17").Activate
Sheets("SalesAnalysis NAGDO").Select
Range("d90").Activate
With Selection.Font
.ColorIndex = 3
End With
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With


End If


End Sub





All times are GMT +1. The time now is 10:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com