Setting text in a macro?

liampog

Active Member
Joined
Aug 3, 2010
Messages
305
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi there

Is there a shorter solution to the following code?

Range("F15").Value = ""
Range("F16").Value = ""
Range("F17").Value = ""
Range("F18").Value = ""
Range("F19").Value = ""
Range("F20").Value = ""
Range("F21").Value = ""
Range("F22").Value = ""
Range("F23").Value = ""
Range("F24").Value = ""
Range("F25").Value = ""
Range("F26").Value = ""
Range("F27").Value = ""
Range("F28").Value = ""
Range("F29").Value = ""
Range("F30").Value = ""
Range("F31").Value = ""
Range("F32").Value = ""
Range("F33").Value = ""
Range("F34").Value = ""
Range("F35").Value = ""
Range("F36").Value = ""
Range("F37").Value = ""
Range("F38").Value = ""
Range("F39").Value = ""
Range("F40").Value = ""
Range("F41").Value = ""
Range("F42").Value = ""
Range("F43").Value = ""
Range("F44").Value = ""
Range("F45").Value = ""
Range("F46").Value = ""
Range("F47").Value = ""
Range("F48").Value = ""
Range("F49").Value = ""
Range("F50").Value = ""

I tried Range("F15:F50").Value = "" but this just didn't work at all.

Am I missing something?

Oh, and I can't use .ClearContents as this comes back with a runtime error because of some Worksheet_Change command I have running.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
You can prevent the Worksheet_Change code from running like this

Code:
Application.EnableEvents = False
Range("F15:F50").ClearContents
Application.EnableEvents = True
 

Forum statistics

Threads
1,176,497
Messages
5,903,400
Members
435,024
Latest member
rpowell90

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