Hello All
I have a scripting which i was wondering whether there is an easier way to write it, for example with an interval. I have tried many ways to write, with For....Next, Do... Loop Until e.t.c., it but it seems that something is always going wrong, like with where is should put the Exit For e.t.c. I should say that this is only a part from a bigger macro which already has an interval and if full of if statements. The total macro seems like that
So what i want is to try and make it simpler so that it will be more easily executed
My scripting is:
Thank you for your assistance!!
I have a scripting which i was wondering whether there is an easier way to write it, for example with an interval. I have tried many ways to write, with For....Next, Do... Loop Until e.t.c., it but it seems that something is always going wrong, like with where is should put the Exit For e.t.c. I should say that this is only a part from a bigger macro which already has an interval and if full of if statements. The total macro seems like that
Code:
For h=1 to 8000
If.......Then
If....Then
ElseIf ....Then
End If
ElseIf ..... Then
If....Then
ElseIf ....Then
End If
..........
.........
End If
Next h
My scripting is:
Code:
ElseIf minval = 0 And minvalnext <> 0 Then
If RowCount <> 6 Then
If ActiveCell.Offset(1, 0) = 0 Then
ActiveCell.Offset(1, 0).Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf ActiveCell.Offset(1, 1) = 0 Then
ActiveCell.Offset(1, 1).Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf ActiveCell.Offset(1, -1) = 0 Then
ActiveCell.Offset(1, -1).Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf ActiveCell.Offset(1, 2) = 0 Then
ActiveCell.Offset(1, 1).Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf ActiveCell.Offset(1, -2) = 0 Then
ActiveCell.Offset(1, -1).Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf ActiveCell.Offset(1, 3) = 0 Then
ActiveCell.Offset(1, 1).Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf ActiveCell.Offset(1, -3) = 0 Then
ActiveCell.Offset(1, -1).Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf ActiveCell.Offset(1, 4) = 0 Then
ActiveCell.Offset(1, 1).Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf ActiveCell.Offset(1, -4) = 0 Then
ActiveCell.Offset(1, -1).Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
EndIf
EndIf