View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Carpe Diem[_2_] Carpe Diem[_2_] is offline
external usenet poster
 
Posts: 1
Default Variables in a cell reference

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