Do Until VBA Loop

csigman

New Member
Joined
Apr 8, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm trying to create a Do Until code in VBA that will populate a certain value in column A until a criteria is met in column B, after which it will populate a second value. I think this should be a relatively quick Do Until code, but unsure how to create it.

Below is a quick example.

Starting at row 6, populate column A with F2 until B="Entity_ID". After that, populate column A with F3 until the end of the data set.
 

Attachments

  • Screenshot (70).png
    Screenshot (70).png
    240 KB · Views: 12

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Welcome to the Board!

Seems like this could be done pretty easily without VBA, just using a formula.
Put this in cell A6 and copy down:
Excel Formula:
=OFFSET(F$1,COUNTIF(B$5:B6,"Entity_ID"),0)
 
Upvote 0
Solution
Welcome to the Board!

Seems like this could be done pretty easily without VBA, just using a formula.
Put this in cell A6 and copy down:
Excel Formula:
=OFFSET(F$1,COUNTIF(B$5:B6,"Entity_ID"),0)
Thank you!!
 
Upvote 0
You are welcome.
Glad I was able to thelp!
 
Upvote 0
he Board!

Seems like this could be done pretty easily without VBA, just using a formula.
Put this in cell A6 and copy down:
Excel Formula:
=OFFSET(F$1,COUNTIF(B$5:B6,"Entity_ID"),0)
Hello - I now have a situation where I need to update the state name to a new name every time I reach the "entity_ID" cell. There could be up to 8 different states that need to be populated down column A. Is this achievable with the formula you provided?
 
Upvote 0
Hello - I now have a situation where I need to update the state name to a new name every time I reach the "entity_ID" cell. There could be up to 8 different states that need to be populated down column A. Is this achievable with the formula you provided?
I am confused. Is that what my formula already does?
How is this new question any different than your original?
This should work regardless of how many states you have.
 
Upvote 0
I am confused. Is that what my formula already does?
How is this new question any different than your original?
This should work regardless of how many states you have.
Apologies - it is working for me. thank you!
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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