Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Type mismatch
TIM wrote:
I get run time error 13 type mismatch from this line of code in VB Cells(cLastRow + 1, "B").Value = Cells(cLastRow, "B").Value + 1 is cLastRow a number? my first two tests work OK herehe Sub test() Dim cLastRow As Long cLastRow = 7 Cells(cLastRow + 1, "B").Value = Cells(cLastRow, "B").Value + 1 End Sub Sub test2() Dim cLastRow As String cLastRow = "7" Cells(cLastRow + 1, "B").Value = Cells(cLastRow, "B").Value + 1 End Sub test3, not surprisingly, produces a type mismatch Sub test3() Dim cLastRow As String cLastRow = "G" Cells(cLastRow + 1, "B").Value = Cells(cLastRow, "B").Value + 1 End Sub -- Steve Garman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Type mismatch... | Excel Discussion (Misc queries) | |||
type mismatch--how to fix | Excel Discussion (Misc queries) | |||
Type mismatch | Excel Programming | |||
Type Mismatch | Excel Programming |