C
Cinco
I've included a portion of a Do loop below. It works (no Run Type Error 13,
Type Mismatch) for x = 1 but fails for x =2. The mismatch occurs on loop #2
with this statement highlighted: Range("$B$1").Value =
Cells(Range("$H$4").Value + x, "D").Value
The H4 cell contains a valid row number which was 270 for loop 1 and is now
271 for loop 2. The totalnumberofsessions value is 4. Here are the Watch
values at time of the failure:
Watch : : Range("$B$1").Value : 7/4/2009 11:24:44 PM : Variant/Date :
Module18.ChartSessions
Watch : : Range("$H$4").Value : 269 : Variant/Double :
Module18.ChartSessions
Watch : : Range("$H$4").Value + x : 271 : Variant/Double :
Module18.ChartSessions
Watch : : x : 2 : Integer : Module18.ChartSessions
I would appreciate someone letting me know what I am doing wrong and how I
can get this to work. Thanks and have a good day.
Jim
' Cycle through all the sessions to process and print charts for each
individual session
Dim x As Integer
Dim totalnumberofsessions As Integer
totalnumberofsessions = Range("$F$4")
x = 1
Do While x <= totalnumberofsessions
Range("$B$1").Value = Cells(Range("$H$4").Value + x, "D").Value
Range("$C$2").Value = Cells(Range("$H$4").Value + x, "F").Value
*** working code here **************
x = x + 1
Loop
Type Mismatch) for x = 1 but fails for x =2. The mismatch occurs on loop #2
with this statement highlighted: Range("$B$1").Value =
Cells(Range("$H$4").Value + x, "D").Value
The H4 cell contains a valid row number which was 270 for loop 1 and is now
271 for loop 2. The totalnumberofsessions value is 4. Here are the Watch
values at time of the failure:
Watch : : Range("$B$1").Value : 7/4/2009 11:24:44 PM : Variant/Date :
Module18.ChartSessions
Watch : : Range("$H$4").Value : 269 : Variant/Double :
Module18.ChartSessions
Watch : : Range("$H$4").Value + x : 271 : Variant/Double :
Module18.ChartSessions
Watch : : x : 2 : Integer : Module18.ChartSessions
I would appreciate someone letting me know what I am doing wrong and how I
can get this to work. Thanks and have a good day.
Jim
' Cycle through all the sessions to process and print charts for each
individual session
Dim x As Integer
Dim totalnumberofsessions As Integer
totalnumberofsessions = Range("$F$4")
x = 1
Do While x <= totalnumberofsessions
Range("$B$1").Value = Cells(Range("$H$4").Value + x, "D").Value
Range("$C$2").Value = Cells(Range("$H$4").Value + x, "F").Value
*** working code here **************
x = x + 1
Loop