isnumeric formula

annadinesh

Board Regular
Joined
Mar 1, 2017
Messages
105
I am using the following formula,

in this case the formula is working , but clear contents is not working


Private Sub Worksheet_Activate()

If IsNumeric(Range("Z1")) = True Then
Sheets("EW").Range("F1").Formula = "=CONCATENATE("" Or Within "",Z1,"" KM "" & CHAR(10) & ""(whichever is earlier)"")"

If IsNumeric(Range("Z1")) = False Then
Sheets("EW").Range("F1").ClearContents

End If
End If

End Sub


please help


dinesh saha
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I am using the following formula,

in this case the formula is working , but clear contents is not working


Private Sub Worksheet_Activate()

If IsNumeric(Range("Z1")) = True Then
Sheets("EW").Range("F1").Formula = "=CONCATENATE("" Or Within "",Z1,"" KM "" & CHAR(10) & ""(whichever is earlier)"")"

If IsNumeric(Range("Z1")) = False Then
Sheets("EW").Range("F1").ClearContents

End If
End If

End Sub


please help


dinesh saha

You don't need the second "IF" statement. Try this:

VBA Code:
Private Sub Worksheet_Activate()

If IsNumeric(Range("Z1")) = True Then
    Sheets("EW").Range("F1").Formula = "=CONCATENATE("" Or Within "",Z1,"" KM "" & CHAR(10) & ""(whichever is earlier)"")"
Else
    Sheets("EW").Range("F1").ClearContents
End If

End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,215,106
Messages
6,123,123
Members
449,096
Latest member
provoking

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