Macro to replace blank cell

LLT

Board Regular
Joined
Nov 4, 2009
Messages
51
Hi Expert,

I need to create macro to look up for column F, if column F is balnk, it will take value in column G but I run into error. I think "" I put is wrong. Can anyone help me on this?
My macro is as follow

Range("I18:I65536").Formula = "=IF(F18="",G18,-F18)"
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Your syntax needs to be as below, but do you really need the formula to go down 65,000+ rows?

Range("I18:I65536").Formula = "=IF(F18="""",G18,-F18)"
 
Upvote 0
Is there anyway to solve the #VALUE! as I have checked the column F is in number.
 
Upvote 0
1. What row is it?

2. What is in columnf F of that row? If it is a formula, please give the formula as well as the result.

3. Suppose the row is row 28, put this formula in a vacant cell:
=ISNUMBER(F28)
Confirm that this formula returns TRUE

4. Suppose the row is row 28, confirm that the formula in I28 is:
=IF(F28="",G28,-F28)
 
Upvote 0
Thanks, it works now when I use ISNUMBER, then show TRUE etc.

Another question, how to delete entire row if Column I =0?
 
Upvote 0
Thanks, it works now when I use ISNUMBER, then show TRUE etc.
What do you mean? This was just a one-off formula in a vacant cell to confirm whether column F really did contain a number. It would have no effect on the rest of the formulas or code. If your column F formula was returning #VALUE! before, it would still be. :confused:

Another question, how to delete entire row if Column I =0?
1. Manually or vba?

2. Starting at a particular row (eg row 18)?

3. If it is to start at row 18, is there anything already in I17?

4. Is this needed because the formulas went all the way down to the bottom of the sheet from the earlier code? Are there other 0 values in amongst your data or just from the bottom of your data down to the bottom of the sheet?
 
Upvote 0
Sorry to cause confusion.

For the previous error showing #Value. I solved it by setting a column I to show True or False result using formula =ISNUMBER(F2). Then set column J to show result =IF(I2=FALSE,G2,-I2).

Now how to create macro to delete column J if this is equal to 0?
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,712
Members
452,939
Latest member
WCrawford

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