Clear a range of data

P

Patrick C. Simonds

I know I can use the code below to clear data from a range, but I need to
clear data from rng(1, 43) through rng(1, 125). Is there any way to do that
without having to write a line for each rng to be cleared?

Sub ClearData()

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

rng(1, 43).Value = ""

End Sub
 
M

Michael Arch

Is this what you need?
set rng = Range(Cells(1,43),Cells(1,125))
rng.clearcontents
 
P

Per Jessen

Hi

Maybe this:

Range(Cells(ActiveCell.Row, 43), Cells(ActiveCell.Row, 125)).ClearContents

Regards,
Per
 
G

Gord Dibben

Dim rng As Range
Set rng = ActiveSheet.Range(Cells(1, 43), Cells(1, 125))
With rng
.Value = ""
End With

Or more simply..................

ActiveSheet.Range(Cells(1, 43), Cells(1, 125)).Value = ""


Gord Dibben MS Excel MVP
 
R

Rick Rothstein

You could always do this...

Sub ClearData()
Range("AQ1:DU1").ClearContents
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top