Loops... they're going to be the death of me.

VBA Struggler

New Member
Joined
Apr 4, 2013
Messages
2
This isin't brain surgery. I can read. I've spent DAYS trying to figure this out and I'm simply spinning my wheels.

Problem

Colum A <-------a buncha junk inbetween----->Column J
John John
Henry
Beth
Francie
Caroline
Bill


I am hopelessly trying to create a subroutine where John is replaced by Henry, then Beth, then Francie, etc. etc. BUT, it can ONLY be J1.

Whomever figures this bad boy out, can you please explain WHY you did whatever you did?

Thanks.

P.S. I actually work in an IT department and I'm too ashamed to ask for their help as none of the them know VBA!!! *sigh*

Thanks again, everyone.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
let's see if I understand:
you have a table:

A J
JohnJohn
Henry
Beth
Francie
Caroline

<tbody>
</tbody>


You want to copy each name from column A to replace the John in Cell J1 and then do something?
 
Upvote 0
Problem

Colum A <-------a buncha junk inbetween----->Column J
John John
Henry
Beth
Francie
Caroline
Bill


I am hopelessly trying to create a subroutine where John is replaced by Henry, then Beth, then Francie, etc. etc. BUT, it can ONLY be J1.
Please explain what you mean by the red highlighted text. Actually, instead of trying to describe in words what you want, why not show us the output you are expecting (unless what you meant by the red highlight text that all entries should somehow go in cell J1)?
 
Upvote 0
code might look something like :

Code:
Dim lastRow as Long
Dim currRow as Long


lastRow = Range("A1").end(xlDown).row


for currRow= 1 to lastRow
   Cells(1,10) = cells(currRow,1)
   .
   .
   .
next
 
Upvote 0
Ok. The Cell J1, which currently has the name John in it, is actually a named range. What it does, really is irrelevent. In fact all the names in column A are named ranges. Once I get the loop performing correctly, each name (and there are a lot more than 6) will go happily on its way doing what I have programmed it to do.

I can't show you any more as I'd never get it past the firewalls. Yup, one of THOSE companies.

So, each name in column A has to go into J1. In turn. And sorry, I didn't mean to put red text in my post.

*sigh* Did that make it any more clear? Or did I just muddle everyone up even more....?
 
Upvote 0

Forum statistics

Threads
1,214,427
Messages
6,119,419
Members
448,895
Latest member
omarahmed1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top