Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Barb's code needs a space before that underscore character.
Sub ClearRange() dim myrange as range set myrange = union(range("A7:BW16"),range("CA7:CV16"), range("A18:DN18"), _ range("A20:BA20")) myrange.value = 9 end sub Alternatively, you could use: Option Explicit Sub ClearRange2() Activesheet.Range("A7:BW16,CA7:CV16,A18:DN18,A20:B A20").Value = 9 end Sub M.A.Tyler wrote: When I debug I get a compile syntax error? Am I doing something wrong? "Barb Reinhardt" wrote: I'm assuming you want to clear all of the ranges listed Sub ClearRange() dim myrange as range set myrange = union(range("A7:BW16"),range("CA7:CV16"), range("A18:DN18"),_ range("A20:BA20")) myrange.value = 9 end sub HTH, Barb Reinhardt "M.A.Tyler" wrote: I need to write a macro that clears several fields and replaces the empty cells with 9. The fields are as follows A7:BW16, CA7:CV16, A18:DN18 AND A20:BA20 Thanks as always! M.A.Tyler -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) |