I have this code which will loop every 12 rows and apply a particular
style to a group of 6 rows. Below is the code that I think should do
the job but doesn’t. Any suggestions?
Dim leftpoint As Integer = 3
Dim rightpoint As Integer = 8
Dim style As Style = xlApp.Styles(xlApp.Styles.Add)
Dim leftpoint As Integer = 3 Dim rightpoint As Integer = 8
Dim style As Style = xlApp.Styles(xlApp.Styles.Add) style.Pattern = BackgroundType.Solid style.ForegroundColor = Drawing.Color.FromArgb(40)
Do If rightpoint > 4467 Then Exit Do Else Dim rng As Range = xlWSheet.Cells.CreateRange("F" & leftpoint.ToString, _ "S" & rightpoint.ToString) rng.Style = style
leftpoint = leftpoint + 12 rightpoint = rightpoint + 12 End If Loop