Instead of Range("B11").Value
, you can use Selection.Value
.
Selection
can be more than 1 cell, so you should probably check for that first.
Question
I'm trying to run a Makro which should use the selected cell as Range.
Instead of Range("B1") it should be something like Range("selectedCell")
My code is like this, and I would like the makro to split the data in the selected cell.
Sub tst()
Dim X As Variant
X = Split(Range("B11").Value, ",")
Range("B11").Resize(UBound(X) - LBound(X) + 1).Value = Application.Transpose(X)
End Sub
Solution
Instead of Range("B11").Value
, you can use Selection.Value
.
Selection
can be more than 1 cell, so you should probably check for that first.
OTHER TIPS
range(selection.address)
keep it simple :)