Concatenate formula with rowcount

I am trying to enter a CONCATENATE formula in a cell with VBA. But the result it writes keep returning false... I need to use a rowcount, since the table grows longer and I need it for THAT row.

This is the latest code I tried, again to no avail:

.Offset(RowCount, 0) = Formula = "=CONCATENATE(P" & RowCount & "J" & RowCount & "DG" & RowCount

Any suggestions would be greatly appreciated.

Answers


You're not creating your string properly and you need to change = Formula = to .Formula =. Also, I'm assuming RowCount is defined somewhere?

Change:

.Offset(RowCount, 0) = Formula = "=CONCATENATE(P" & RowCount & "J" & RowCount & "DG" & RowCount

To:

.Offset(RowCount, 0).Formula = "=CONCATENATE(P" & RowCount & ",J" & RowCount & ",DG" & RowCount & ")"

You might also use R1C1 addressing instead:

.Offset(RowCount, 0).FormulaR1C1 = "=CONCATENATE(R[-1]C16,R[-1]C10,R[-1]C111)"

Need Your Help

WordPress isn't removing Bootstrap's collapse class 'in'

jquery css wordpress twitter-bootstrap-3

I am using a Bootstrap collapse areas to hide info until the panel is collapsed. I have to show you my site because I cannot recreate the problem in JSfiddle because it works there but not on my si...

animate slide up and down UIView based on indexPath.row

ios objective-c uitableview slidedown slideup

right now I'm trying to move up and move down an UIView based on roll up or down in UITableView. So, if I rolled up the view, which means indexPath.row will keep incremented; the view will appear s...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.