Getting around a Mixed Variable Type
Thanks Rick,I am going with Eric G's last response.
Thanks
EM
"Rick Rothstein" wrote:
It is hard to figure out exactly what you are trying to do with the code you
posted. You are assigning the target row to 'h' and then concatenating 'h'
with the target row (which is already assigned to 'h', so why not just use
'h' instead of Target.Row?)... and then you are adding 'h' to something, but
it is not clear whether you want to add it to the target row first, before
concatenating it onto 'h', or if you want to add it to the number produced
by concatenating 'h' and Target.Row (which is what 'h' equals). Then you are
concatenating a colon onto the end of that... it looks like you may be
trying to form a range address, but that is not entirely clear. Can you
clarify what you are actually attempting to do with your code?
Also, most people would write this line...
If Target.Rows.Count - 1 = 0 Then
like this...
If Target.Rows.Count = 1 Then
--
Rick (MVP - Excel)
"Excel Monkey" wrote in message
...
I have a loop. Within this loop I have a variable "h" which is appended by
the current version of itself. I am using a delimiter of ":" during each
append. However I keep getting a type mismatch error as I have
dimensioned
"h" as a Double. I think adding the ":" triggers the error. I can't
change
"h" to a String as the addition logic that creates the appending will not
work. How do I get around this?
Dim h as double
For g = 0 To Target.Rows.Count - 1
If Target.Rows.Count - 1 = 0 Then
h = Target.Row
Else
h = h & Target.Row + h & ":"
End If
Next
Thanks
EM
|