View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Variables in a cell reference

if he wants the string literal you are building, why not

= "B1 C1"

--
Regards,
Tom Ogilvy


"JLGWhiz" wrote:

Try: Selection.Value = "B1" & Chr(32) & "C1"


"Carpe Diem" wrote:

I would like to know how I could combine cells with variables if possible.
Something similar to the Selection.Value Selection.Value = B1& C1
line in the code below but which operates like (x,2)&"" ""&(x,3) so I can
get the appropriate cells to add together with a space in between.

I am likely mixing syntax as I am unfamiliar with VB.
Sub Ne()
Dim y As Integer
Dim x As Integer
Cells(4, 10) = "=COUNTA(A:A,"" * "")-1"
y = Cells(4, 10)
For x = 1 To y
Cells(x, 1).Select
Selection.Value = B1& C1
Next x
End Sub