Selecting Data in Column

  • Thread starter Thread starter Rex Dunlap
  • Start date Start date
R

Rex Dunlap

The following code gets the last data cell in column B:
Range("b20000").End(xlUp).Select

I would now like to select the Range("Activecell:B2"). How
do I do that?

Thank you for your help.
 
Hi
try
range(cells(2,2),cells(ActiveSheet.Cells(Rows.Count,
"B").End(xlUp).row,2)).select

though in most cases it is not required to select cells within in
macro
 
Hi Rex,

Try

Range("B2:B" & RANGE("B20000").End(xlUp).Row).Select


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Frank, just so I learn this correctly, you say that I
don't need to select cells to do something with a macro.

What I wanted to was select all the blank cells in B and
put the word "NO" in them. With your help this is what I
have:

Range("b20000").End(xlUp).Select
Range(Cells(5, 2), Cells(ActiveSheet.Cells
(Rows.Count, "B").End(xlUp).Row, 2)).Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Value = "NO"
Range("A4").Select

Would you do it differently?

Thanks for your help in at least getting me this far and
saving me so much time!

Kind regards,
Rex
 
This

Range(Cells(5, 2), Cells(ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row,
2)).Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Value = "NO"
Range("A4").Select

can be written as

Range("B5:B" & Range("B" &
Rows.Count).End(xlUp).Row).SpecialCells(xlCellTypeBlanks).Value = "NO"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thank you very much, Bob.
-----Original Message-----
This

Range(Cells(5, 2), Cells(ActiveSheet.Cells
(Rows.Count, "B").End(xlUp).Row,
2)).Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Value = "NO"
Range("A4").Select

can be written as

Range("B5:B" & Range("B" &
Rows.Count).End(xlUp).Row).SpecialCells
(xlCellTypeBlanks).Value = "NO"
 

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

Back
Top