Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 11th, 2007, 03:22 PM
Registered User
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using data from one cell to add to another

I want to make a counter system to add to a string, so I have say:
Cell A1 : Bob
but I want to make it into
Cell A1 : Bob1
Cell A2 = Bob2
And so on..

I understand it's along the lines of
Activecell.FormulaR1C1 = *data string 1* + *data string 2*, but how would I use this if data strings 1 and 2 were cell references?

(I know how to do the rest (cell offset etc) but it's just this line I'm struggling with)

Thanks in advance.

Old September 12th, 2007, 03:27 PM
Friend of Wrox
Join Date: Feb 2007
Posts: 163
Thanks: 0
Thanked 2 Times in 2 Posts

This can be done with a simple formula. Type this in the cell then populate down:
="Bob" & ROW()

In code where you're not using a formula:
ActiveCell.Value = "Bob" & ActiveCell.Row

If you are iterating over a range:

Dim CellOn As Range
For Each CellOn In Range("A1:A12")
  CellOn.Value = "Bob" & CellOn.Row

Similar Threads
Thread Thread Starter Forum Replies Last Post
how data grid of vb.net add cell color Nuwang Forum and Wrox.com Feedback 0 September 10th, 2008 08:36 PM
Add a button to a cell hewstone999 Access VBA 2 June 4th, 2008 07:23 AM
Copy data into cell by cell zone Excel VBA 2 September 4th, 2007 11:50 AM
insert text to active cell by shared add-in Medes Excel VBA 0 May 5th, 2006 01:53 AM
How to add data to a DataGrid Cell. chiefouko VS.NET 2002/2003 2 July 28th, 2004 01:24 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.