Adjacent Cell Formula That Skips Blanks

breynolds0431

Active Member
Joined
Feb 15, 2013
Messages
303
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I currently have a macro that will ensure column A has a formula inserted as long as the corresponding cell in column C is not blank. It will do this by going down column C until it hits a blank cell and add the formula to all rows up to that point. But, what I fear is that there might be a blank cell in column C on error and the code will prematurely stop at that row. What I'm hoping is that there's an easy way for the code to continue if the next row (or maybe check the next 5 rows) is not blank and continue with the formulas in column A.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Then you probably have to show your code in order to get suggestions to improve it
 
Upvote 0
Fairly standard code:

VBA Code:
Range("A2:A" & Range("C" & Rows.Count.End(xlUp).Row).Formula = _
  "[formula here]"
 
Upvote 0
That's your working code?

Seems like there's a missing )
Rich (BB code):
Range("A2:A" & Range("C" & Rows.Count).End(xlUp).Row).Formula = "[formula here]"
                                     ^

Anyway, do you even know how your code works?
It goes from bottom up, and not top down like you mentioned, meaning there wouldn't be the problem you mentioned, since it goes to the last filled cell on column C.
 
Upvote 0
Thanks random. Btw... Is this really how you talk to people who are on a forum looking for assistance? Because you come off as a pompous ******* (report me, I really could care less) and I think everyone would be much better off without you chiming in with this horrible, seemingly arrogant attitude. Or maybe find a forum where you can ask for assistance on how to interact with people before returning to this forum to lend your knowledge. Just a thought.
 
Upvote 0
I think everyone would be much better off without you chiming in with this horrible, seemingly arrogant attitude.
Pretty sure at least one other person here thinks otherwise.

When you ask questions, give details, show what you have, if not it'll be better off for you to post in a mind-reading forum.
 
Upvote 0

Forum statistics

Threads
1,213,568
Messages
6,114,348
Members
448,570
Latest member
rik81h

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