![]() |
Clear a range of data
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 |
Clear a range of data
Is this what you need?
set rng = Range(Cells(1,43),Cells(1,125)) rng.clearcontents -- If this posting was helpful, please click on the Yes button. Regards, Michael Arch. "Patrick C. Simonds" wrote: 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 |
Clear a range of data
Hi
Maybe this: Range(Cells(ActiveCell.Row, 43), Cells(ActiveCell.Row, 125)).ClearContents Regards, Per "Patrick C. Simonds" skrev i meddelelsen ... 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 |
Clear a range of data
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 On Mon, 16 Mar 2009 11:27:04 -0700, "Patrick C. Simonds" wrote: 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 |
Clear a range of data
You could always do this...
Sub ClearData() Range("AQ1:DU1").ClearContents End Sub -- Rick (MVP - Excel) "Patrick C. Simonds" wrote in message ... 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 |
All times are GMT +1. The time now is 02:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com