Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default 2 below first entry in row

Been trying to solve this on my own, but can't get it right.

Row 3 contains numbers. I want a line that selects the cell 2 rows under
the first number (location varies month to month) in that row.

This does it for *last* number:

Cells(3, Columns.Count).End(xlToLeft).Offset(2, 0).Select

How to modify?

--
David
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 2 below first entry in row


Not entirely sure what you want but you could try :-

Range("A1").select
xlDown

or something like this, the xlDown will find the next empty cell i
that row.

Simo

--
Simon Lloy
-----------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670
View this thread: http://www.excelforum.com/showthread.php?threadid=26154

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 2 below first entry in row

Hi David,

You cpuld use the SpecialCells method:

Sub test()
Dim rng As Range
On Error Resume Next
Set rng = Rows(3).SpecialCells(xlCellTypeConstants, _
xlNumbers)(1, 3)
On Error GoTo 0

If Not rng Is Nothing Then
MsgBox rng.Address
Else
' Do something else
End If
End Sub

If your numbers are formulae, change xlCellTypeConstants to
xlCellTypeFormulas. If your numbers could be constants or formulae, you
would need to build a union range.


---
Regards,
Norman



"David" wrote in message
...
Been trying to solve this on my own, but can't get it right.

Row 3 contains numbers. I want a line that selects the cell 2 rows under
the first number (location varies month to month) in that row.

This does it for *last* number:

Cells(3, Columns.Count).End(xlToLeft).Offset(2, 0).Select

How to modify?

--
David



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default 2 below first entry in row

3rd option :)
works with numbers AND text, and is reasonably fast

example..
FirstNonBlank(3).Offset(2,0).select


Function FirstNonBlank(rownum As Long) As Range
'Note: works on activesheet only
With Rows(rownum)
If IsEmpty(.Cells(1)) And Application.CountA(.Cells) < 0 Then
Set FirstNonBlank = .Cells(1).End(xlToRight)
Else
Set FirstNonBlank = .Cells(1)
End If
End With
End Function


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


David wrote:

Been trying to solve this on my own, but can't get it right.

Row 3 contains numbers. I want a line that selects the cell 2 rows under
the first number (location varies month to month) in that row.

This does it for *last* number:

Cells(3, Columns.Count).End(xlToLeft).Offset(2, 0).Select

How to modify?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default 2 below first entry in row

David wrote:

Been trying to solve this on my own, but can't get it right.

Row 3 contains numbers. I want a line that selects the cell 2 rows under
the first number (location varies month to month) in that row.

This does it for *last* number:

Cells(3, Columns.Count).End(xlToLeft).Offset(2, 0).Select

How to modify?


Range("3:3").Find("*", Range("iv3"))(3, 1)

Alan Beban


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default 2 below first entry in row

Thanks to all who replied.
Since I like *simple* and there will always be at least one number to the
left of G3, I played with the results of recording Ctrl+LeftArrow and this
does what I want:

Range("G3").End(xlToLeft).Offset(2, 0).Select

--
David
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 2 below first entry in row

Alan Beban wrote in message ...

Range("3:3").Find("*", Range("iv3"))(3, 1)


At first I couldn't get this to work, getting an 'Expected: =' Compile
error. On a hunch, added .Select to it and it works fine. Thanks. Now
I have a choice.

---
David
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I lock a cell after data entry so entry can not be changed Verlinde Excel Discussion (Misc queries) 3 April 22nd 10 07:59 PM
Excel 2002 date entry: Cannot get away from d-m-yy entry format Steve Eklund Excel Discussion (Misc queries) 3 May 11th 09 04:57 PM
Control Data Entry - push entry to next cell Ofelia Excel Discussion (Misc queries) 0 July 7th 08 04:19 PM
Auto entry of data based on entry of text in another column or fie Judy Rose Excel Discussion (Misc queries) 2 May 21st 08 01:14 PM
Cell Entry That Locks Selected Cells From Any Data Entry. ron Excel Worksheet Functions 5 February 16th 07 09:52 PM


All times are GMT +1. The time now is 02:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"