isnumeric formula

annadinesh

Board Regular
Joined
Mar 1, 2017
Messages
124
Office Version
  1. 2019
Platform
  1. Windows
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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
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,224,091
Messages
6,176,294
Members
452,719
Latest member
Boonchai Charoenek

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