vba, how to go to Col B in whatever row is active

H

Harold Good

Hi,

I'm new to VBA but didn't find the help I need online. I'd like some simple code to enable a client to add a new row to a budget cost center. There may be 20 cost centers, each with 4 rows for entering budget information in the budget form I give them. But some cost centers will need more detailed descriptions, thus another row or two may need to be added by the client.

I would like for them to be able to click once in any of the 4 rows (to make it the active cell) in a given cost center (the fifth row is a summary row), then either click a button or a execute key combination to add a new row within that cost center.

1. So the first thing the code needs to do is go to Column B while staying in the current row. I don't know how to do the code for this.

In Column B every cell has a Cost Center number. B5:B10 might be 64400; B11:B15 might be 63300.

2. So after the code arrives in Col B, I'd like it to move down until it finds the first cell which is not equal to the cell above it. That is where I'll insert the new row, keeping it within the same cost center rows.

If anyone can help with some code to do these two steps, I'd really appreciate it!

Thank you,
Harold
 
H

Harold Good

I prefer to do it with VBA so I can also have it copy cost center number to
the new row, and all formating as well, including merged cells. Ctrl I,R
won't do all that.

I assumed it would be quite easy with VBA code to go to column B from
wherever the Activecell was, and then loop down checking to find the first
unequal cost center number. But maybe it isn't that simple.

Harold
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top