In J1 is a1:b10
In K1 is a1
In L1 is b10
OK, so this works: Set rng = Range(Range("j1"))
This does not: Set rng = Range(Range("K1"), Range("L1")). I get an error. Why won't this work? I get an error "type mismatch".
Not sure if it's important, here's the test program I was running:
Private Sub CommandButton1_Click()
Dim rng As Range, cell As Range
Set rng = Range(Range("j1"))
For Each cell In rng
cell.Value = cell.Value * 2
Next cell
End Sub
In K1 is a1
In L1 is b10
OK, so this works: Set rng = Range(Range("j1"))
This does not: Set rng = Range(Range("K1"), Range("L1")). I get an error. Why won't this work? I get an error "type mismatch".
Not sure if it's important, here's the test program I was running:
Private Sub CommandButton1_Click()
Dim rng As Range, cell As Range
Set rng = Range(Range("j1"))
For Each cell In rng
cell.Value = cell.Value * 2
Next cell
End Sub