View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bruce Roberson[_2_] Bruce Roberson[_2_] is offline
external usenet poster
 
Posts: 23
Default Select two consecutive rows

I'll try this in the morning when I get to work, but is this going to work
if the active cell is blank, and the cell to the right and the cell below
are not blank?

Bruce
"Tom Ogilvy" wrote in message
...
Range(ActiveCell.End(xlDown),ActiveCell.End(xlToRi ght)).Select

Regards,
Tom Ogilvy



Bruce Roberson wrote in message
...
Tom:

Actually what I'm running into is this:

I'm sitting in Cell A10 which is the left most corner of an area I need
to highlight for an advanced query setup with fields. I got there with
the command below since I had been in Cell B10 when I made my copy of
the range type2header:

ActiveCell.Offset(0, -1).Select

From Cell A10, I have contiguous data beginning in cells A11 and in Cell
B10. From there it is contiguous down through lets say to cell S325. I
also have a complication in that Cells B326 through H326 should not be
highlighted as they are a different data type and not needed for the
advanced query operation. Now these are not finite row numbers; they
will always vary each month as to how far down it goes.

Ordinarily I might have done a selection of the current region, but I
guess you can see that won't work in this case. If I try and go end down
end right with the commands below, it does not work to make the
selection I need.

Range(ActiveCell, ActiveCell.End(xlDown)).Select
Range(ActiveCell, ActiveCell.End(xlToRight)).Select

So, I'm stuck at this point on how to highlight what I need.
Listed below is my full routine so far.
__________________________________________________ __________

Sub Copytype2hdr()
Range("startexportcell").Offset(1, 0).Select 'Selects B9
Selection.EntireRow.Insert 'Inserting one row
Range("Type2header").Copy 'header for adv query
ActiveCell.PasteSpecial xlPasteValues 'paste header in B10
Application.CutCopyMode = False
ActiveCell.Offset(0, -1).Select move cursor to A10
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
End Sub






*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!