Bass71
MIS
- Jun 21, 2001
- 79
Hi:
I am trying to concatenate between 2-20 cells in a spreadsheet using a macro. The problem is that each time I run a previous macro, the number of cells in the row may differ. I'm thinking I should go from the rightmost cell and work left. I was thinking of taking the cell.count method and somehow tying that number to an object and then working n-1 in the concatenation formula until it equals 1 i.e. the first column. Here's the code:
Dim number As Integer
Dim area As Range
number = number + Selection.Cells.Count
Range("A1"
.Select
Selection.End(xlToRight).Select
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = _
"=CONCATENATE(RC[-3],RC[-2],RC[-1])"???? <<I need to somehow express the 'number' object in the RC as a variable until it runs into column A.>>
Thanks for your help, you guys are great.............Rickie
I am trying to concatenate between 2-20 cells in a spreadsheet using a macro. The problem is that each time I run a previous macro, the number of cells in the row may differ. I'm thinking I should go from the rightmost cell and work left. I was thinking of taking the cell.count method and somehow tying that number to an object and then working n-1 in the concatenation formula until it equals 1 i.e. the first column. Here's the code:
Dim number As Integer
Dim area As Range
number = number + Selection.Cells.Count
Range("A1"
Selection.End(xlToRight).Select
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = _
"=CONCATENATE(RC[-3],RC[-2],RC[-1])"???? <<I need to somehow express the 'number' object in the RC as a variable until it runs into column A.>>
Thanks for your help, you guys are great.............Rickie