S
smandula
I have a conflict in VBA
-------------------------------------
Sub sequence11()
With Sheets("Sheet2")
x5 = Range("J1").Value
x6 = Range("J2").Value
Set x = .Range("B" & x6 & ":G" & x5)
End With
For Each c In x
If c.Value = (c.Offset(0, 1).Value - 1) Then
Range(c, c.Offset(0, 1)).Select
With Selection.Interior
..Color = RGB(255, 204, 153) '222, 222, 222 Gray
..Pattern = xlSolid
End With
End If
Next
Range("A1").Select
End Sub
'---------------------------------------------------
Sub bonussequence()
With Sheets("Sheet2")
Set x = .Range(.Range("K2"), .Range("N31"))
End With
For Each c In x
If c.Value = (c.Offset(0, 1).Value - 1) Then
Range(c, c.Offset(0, 1)).Select
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
End If
Next
Range("A1").Select
End Sub
'----------------------------------------------------
The last macro will not finish
Both are used on the same sheet,
Both have different objects,or GUI
When tried separately on different worksheets, they work
Any suggestions, I would like to have them work indepent,
on same worksheet.
With Thanks
-------------------------------------
Sub sequence11()
With Sheets("Sheet2")
x5 = Range("J1").Value
x6 = Range("J2").Value
Set x = .Range("B" & x6 & ":G" & x5)
End With
For Each c In x
If c.Value = (c.Offset(0, 1).Value - 1) Then
Range(c, c.Offset(0, 1)).Select
With Selection.Interior
..Color = RGB(255, 204, 153) '222, 222, 222 Gray
..Pattern = xlSolid
End With
End If
Next
Range("A1").Select
End Sub
'---------------------------------------------------
Sub bonussequence()
With Sheets("Sheet2")
Set x = .Range(.Range("K2"), .Range("N31"))
End With
For Each c In x
If c.Value = (c.Offset(0, 1).Value - 1) Then
Range(c, c.Offset(0, 1)).Select
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
End If
Next
Range("A1").Select
End Sub
'----------------------------------------------------
The last macro will not finish
Both are used on the same sheet,
Both have different objects,or GUI
When tried separately on different worksheets, they work
Any suggestions, I would like to have them work indepent,
on same worksheet.
With Thanks