ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel skip some lines of VBA code (https://www.excelbanter.com/excel-programming/275295-excel-skip-some-lines-vba-code.html)

Alex[_7_]

Excel skip some lines of VBA code
 
I have some code
that work in debug mode but not work if i run it normaly
(if i run it normaly
excel enter to the if condition only 1 time)

What can i do with it??


Sub FormatNow()
Dim Grow As Long
For Grow = 4 To 31640
If Sheet1.Range(Cells(Grow, 8), Cells(Grow, 8)).Interior.Color =
12648447 Then
'MsgBox Grow
Sheet1.Range(Cells(Grow, "Z"), Cells(Grow, "Z")).Value =
Sheet1.Range(Cells(Grow, 8), Cells(Grow, 8)).Value
'MsgBox Sheet1.Range(Cells(Grow, "Z"), Cells(Grow, "Z")).Value
End If
Next
End Sub



Reg Besseling

Excel skip some lines of VBA code
 
Name your sheetfully i.e. workbook.sheet
"Alex" wrote in message
...
I have some code
that work in debug mode but not work if i run it normaly
(if i run it normaly
excel enter to the if condition only 1 time)

What can i do with it??


Sub FormatNow()
Dim Grow As Long
For Grow = 4 To 31640
If Sheet1.Range(Cells(Grow, 8), Cells(Grow, 8)).Interior.Color =
12648447 Then
'MsgBox Grow
Sheet1.Range(Cells(Grow, "Z"), Cells(Grow, "Z")).Value =
Sheet1.Range(Cells(Grow, 8), Cells(Grow, 8)).Value
'MsgBox Sheet1.Range(Cells(Grow, "Z"), Cells(Grow, "Z")).Value
End If
Next
End Sub






All times are GMT +1. The time now is 09:47 PM.

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