Pergunta

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
Foi útil?

Solução

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.

Outras dicas

  range(selection.address)

keep it simple :)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top