Facing issue with "If IsEmpty"

Rohith1324

Board Regular
Joined
Feb 27, 2018
Messages
114
Hi,

I have cell where there is simple formula as below :

1631165169810.png


And basis on the above cell I have VBA code where I am using the "If IsEmpty" -

but when I execute the code I think the code is not considering the cell as empty when
1631165385323.png
and its moving and executing the else part of it.

If IsEmpty(C.Offset(0, 75).Value) = True Then
Else
bot.FindElementByXPath("//*[@id='N317:QuantityShipped:" & (C.Offset(0, 75).Value) & "']").Clear
bot.FindElementByXPath("//*[@id='N317:QuantityShipped:" & (C.Offset(0, 75).Value) & "']").SendKeys C.Offset(0, 9).Value
End If

Could someone please assist on how to fix this.

Regards,
Rohith
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi,

I have cell where there is simple formula as below :

View attachment 46558

And basis on the above cell I have VBA code where I am using the "If IsEmpty" -

but when I execute the code I think the code is not considering the cell as empty when View attachment 46559 and its moving and executing the else part of it.

If IsEmpty(C.Offset(0, 75).Value) = True Then
Else
bot.FindElementByXPath("//*[@id='N317:QuantityShipped:" & (C.Offset(0, 75).Value) & "']").Clear
bot.FindElementByXPath("//*[@id='N317:QuantityShipped:" & (C.Offset(0, 75).Value) & "']").SendKeys C.Offset(0, 9).Value
End If

Could someone please assist on how to fix this.

Regards,
Rohith
=try formula COUNTA=TRUE
 
Upvote 0
=try formula COUNTA=TRUE
May be I just wanted to bit clarify my requirements :

the Cell would be visually blank ( due to the formula in excel the cell will be showing no values ) but when you click on that particular cell it would have an formula.

My requirement is that inspite the cell contains formula but visually blank I want to write VBA Code saying when the Cell is visually blank it should tell "Yes"/"True" if that gives me the result I can execute the rest of the script ( it has many lines )
 
Upvote 0
Try replacing:
VBA Code:
If IsEmpty(C.Offset(0, 75).Value) = True Then
with:
VBA Code:
If Len(C.Offset(0, 75).Value) = 0 Then
 
Upvote 0
Or even
VBA Code:
If C.Offset(0, 75).Value = "" Then
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,715
Members
448,985
Latest member
chocbudda

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