ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I select a range of cells without doing Range("a3", "f3").. (https://www.excelbanter.com/excel-programming/319339-how-do-i-select-range-cells-without-doing-range-a3-f3.html)

Miriam

How do I select a range of cells without doing Range("a3", "f3")..
 
Hi, does anyone know how to select a range of cells without using exact
references?

Basically what I want to do is

If a20 = blank or zero, I want to delete cells in that row from a to f
(then I will test the next cell)

(Selection.Delete Shift:=xlUp)

Trevor Shuttleworth

How do I select a range of cells without doing Range("a3", "f3")..
 
Miriam

something like:

Range(Activecell,Activecell.Offset(0,5)).Select

You might want to check that the Active cell is in Column A

You don't need to select the cells though:

Range(Activecell,Activecell.Offset(0,5)).Delete Shift:=xlUp

Regards

Trevor


"Miriam" wrote in message
...
Hi, does anyone know how to select a range of cells without using exact
references?

Basically what I want to do is

If a20 = blank or zero, I want to delete cells in that row from a to f
(then I will test the next cell)

(Selection.Delete Shift:=xlUp)




Bob Phillips[_6_]

How do I select a range of cells without doing Range("a3", "f3")..
 

Do
If Range("A20").Value = 0 Or Range("A20").Value = "" Then
Range("A20:F20").Delete Shift:=xlUp
End If
Loop Until Range("A20").Value < 0 And Range("A20").Value < ""

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Miriam" wrote in message
...
Hi, does anyone know how to select a range of cells without using exact
references?

Basically what I want to do is

If a20 = blank or zero, I want to delete cells in that row from a to f
(then I will test the next cell)

(Selection.Delete Shift:=xlUp)





All times are GMT +1. The time now is 03:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com