Adjacent Cell Formula That Skips Blanks

breynolds0431

Board Regular
Joined
Feb 15, 2013
Messages
69
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.
 

Some videos you may like

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

aRandomHelper

Board Regular
Joined
Jan 14, 2021
Messages
225
Office Version
  1. 2016
Platform
  1. Windows
Then you probably have to show your code in order to get suggestions to improve it
 

breynolds0431

Board Regular
Joined
Feb 15, 2013
Messages
69
Fairly standard code:

VBA Code:
Range("A2:A" & Range("C" & Rows.Count.End(xlUp).Row).Formula = _
  "[formula here]"
 

aRandomHelper

Board Regular
Joined
Jan 14, 2021
Messages
225
Office Version
  1. 2016
Platform
  1. Windows
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.
 

breynolds0431

Board Regular
Joined
Feb 15, 2013
Messages
69
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.
 

aRandomHelper

Board Regular
Joined
Jan 14, 2021
Messages
225
Office Version
  1. 2016
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,529
Messages
5,625,352
Members
416,096
Latest member
forevans

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
Top