View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme[_3_] Bernard Liengme[_3_] is offline
external usenet poster
 
Posts: 1,104
Default Using a variable in the Range function

This worked for me
Sub tryme()
Dim x As String
x = Application.InputBox(prompt:="Enter target cell address")
Range(x) = "hello, World"
End Sub

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"Dee Sperling" <Dee wrote in message
...
I found this great module on he
Sub ConcatSelection()
Dim rng As Range
Dim strConcat As String

For Each rng In Selection
strConcat = strConcat & " " & rng.Text
Next
Range("F2") = strConcat
End Sub

It works nicely to concatenate the user-selected cells, but I'd like the
user to be able to chose the destination cell. Is that possible?
I tried adding this line above the Range line:
x = Application.InputBox(prompt:="enter the value", Type:=1)
then changed Range("F2") = strConcat to Range(x) = strConcat

But I got an error.
Is it possible to do this?

Thank you,
Dee