Reputation: 348
What I am trying to do is simple but I just can't get it to work. I want select a range of cells and the run a macro that will:
This is what I have for the code:
Dim myRange As Range
Set myRange = Selection
First_Col = myRange.Column
Last_Row = myRange.Rows.Count + myRange.Row - 1
Last_Col = myRange.Column + myRange.Columns.Count - 1
Out_put_Col = Last_Col + 1
For i = myRange.Row To Last_Row
Cells(i, Out_put_Col) = "=NUMBERVALUE(Cells(i, First_Col) & Cells(i, First_Col+1)"
Next i
VBA is having issues with what is written in the for loop. I am newer to VBA but based on the way this is written I would have though it would work. Thanks for the help.
Upvotes: 0
Views: 284
Reputation: 166316
more like:
For i = myRange.Row To Last_Row
Cells(i, Out_put_Col) = "=NUMBERVALUE(" & Cells(i, First_Col).address & ":" & _
Cells(i, First_Col+1).address & ")"
Next i
I'm not sure NumberValue works like that though.
Upvotes: 1