Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to direct users to the empty row below the last record in excel

I need help. i want to direct users to the empty row just below the las
record in excel. what is the coding

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to direct users to the empty row below the last record in excel

something like this... assuming your data includes A1



sub NextRow()

sheet1.rows(sheet1.range("A1").currentregion.rows. count+1).select

end sub



Either attach it to a button or include it in the openworkboo
procedure in the workbook.

Hope this is of some help

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default how to direct users to the empty row below the last record in excel


cLastRow = Cells(Rows.Count,"A").End(xlUp).Row

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"shirley " wrote in message
...
I need help. i want to direct users to the empty row just below the last
record in excel. what is the coding?


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default how to direct users to the empty row below the last record in excel

Hi,
Could you say what direct means and when it should happen?
regards
Paul

shirley wrote in message ...
I need help. i want to direct users to the empty row just below the last
record in excel. what is the coding?


---
Message posted from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default how to direct users to the empty row below the last record in excel

The following function is something that I've amended from
Walkenbach's book (I think). It gives the last used row in a
particular column. As I recollect, Walkenbach's code is more compact
(and works perfectly of course) but is harder to understand.

So to run the following function, you'd maybe put something like:
dim mysheet as worksheet
set mysheet=activeworkbook.worksheets("Sheet1")
mysheet.cells(ColumnLast(mysheet,7),7).activate
.....



Function ColumnLast(inputsheet as worksheet,colnum as integer) as
integer
Dim rng1 as range,rng2 as range, rng3 as range
Dim collen as integer, i as integer

set rng1 = inputsheet.columns(colnum)
set rng2 = inputsheet.usedrange
set rng3 = intersect(rng1,rng2)
collen=rng3.count

for i=collen to 1 step -1
if not IsEmpty(rng3(i)) then
ColumnLast = i+1
Exit Function
next i

columnlast=1

end function



shirley wrote in message ...
I need help. i want to direct users to the empty row just below the last
record in excel. what is the coding?


---
Message posted from http://www.ExcelForum.com/



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default how to direct users to the empty row below the last record in excel

Simon,

Apart from the fact that this has a missing End IF which gives a compile
error and that it gives the last+1 rather than last, it seems very
complicated and inefficient compared to this tried and trusted method,
adapted to your example


mySheet.Cells(activesheet.Cells(Rows.Count,"G").En d(xlUp).Row,7).Activate

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Simon Prince" wrote in message
om...
The following function is something that I've amended from
Walkenbach's book (I think). It gives the last used row in a
particular column. As I recollect, Walkenbach's code is more compact
(and works perfectly of course) but is harder to understand.

So to run the following function, you'd maybe put something like:
dim mysheet as worksheet
set mysheet=activeworkbook.worksheets("Sheet1")
mysheet.cells(ColumnLast(mysheet,7),7).activate
....



Function ColumnLast(inputsheet as worksheet,colnum as integer) as
integer
Dim rng1 as range,rng2 as range, rng3 as range
Dim collen as integer, i as integer

set rng1 = inputsheet.columns(colnum)
set rng2 = inputsheet.usedrange
set rng3 = intersect(rng1,rng2)
collen=rng3.count

for i=collen to 1 step -1
if not IsEmpty(rng3(i)) then
ColumnLast = i+1
Exit Function
next i

columnlast=1

end function



shirley wrote in message

...
I need help. i want to direct users to the empty row just below the last
record in excel. what is the coding?


---
Message posted from http://www.ExcelForum.com/



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default how to direct users to the empty row below the last record in excel

Bob,
Apologies for the missing end if, I was copying from laptop to
desktop. I stand in awe of the simplicity of your approach. Many
thanks. Always learning.

Simon

"Bob Phillips" wrote in message ...
Simon,

Apart from the fact that this has a missing End IF which gives a compile
error and that it gives the last+1 rather than last, it seems very
complicated and inefficient compared to this tried and trusted method,
adapted to your example


mySheet.Cells(activesheet.Cells(Rows.Count,"G").En d(xlUp).Row,7).Activate

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Simon Prince" wrote in message
om...
The following function is something that I've amended from
Walkenbach's book (I think). It gives the last used row in a
particular column. As I recollect, Walkenbach's code is more compact
(and works perfectly of course) but is harder to understand.

So to run the following function, you'd maybe put something like:
dim mysheet as worksheet
set mysheet=activeworkbook.worksheets("Sheet1")
mysheet.cells(ColumnLast(mysheet,7),7).activate
....



Function ColumnLast(inputsheet as worksheet,colnum as integer) as
integer
Dim rng1 as range,rng2 as range, rng3 as range
Dim collen as integer, i as integer

set rng1 = inputsheet.columns(colnum)
set rng2 = inputsheet.usedrange
set rng3 = intersect(rng1,rng2)
collen=rng3.count

for i=collen to 1 step -1
if not IsEmpty(rng3(i)) then
ColumnLast = i+1
Exit Function
next i

columnlast=1

end function



shirley wrote in message

...
I need help. i want to direct users to the empty row just below the last
record in excel. what is the coding?


---
Message posted from http://www.ExcelForum.com/

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to direct users to the empty row below the last record in excel

Hi to all,

thanks for the help.
when i added in the code

dim mysheet as worksheet
set mysheet=activeworkbook.worksheets("Sheet6")

mySheet.Cells(activesheet.Cells(Rows.Count,"A").En d(xlUp).Row,7).Activate

i received an error = "subscript out of range"

what is wrong? btw, does the code mean to count through all rows, g
to the last record which is the last row? what does 7 means

--
Message posted from http://www.ExcelForum.com

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to direct users to the empty row below the last record in excel

Hi to all again,

i think i got the code. i made some changes to accomodate my progra
and solve the out of subscript problem.

Dim mysheet As Worksheet
Set mysheet = ActiveSheet
mysheet.Row.Cells(ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
1).Next.Activate


However, this code brings me to the last record. How do i change th
code to bring me to the empty row jus under the last row it found

--
Message posted from http://www.ExcelForum.com

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
sharing excel sheet with multiple users, but other users cant see lana.b Excel Discussion (Misc queries) 3 January 25th 09 11:15 AM
Auto E-Faxing direct from Excel. destroyer Excel Discussion (Misc queries) 0 August 22nd 06 08:21 AM
Emailing XML direct from Excel Ne1 Excel Discussion (Misc queries) 4 September 22nd 05 01:11 PM
Warn for an Empty Record Soniya Excel Programming 5 August 13th 03 03:02 PM
SOS VBA Code Emergency: need to copy tell to empty cell direct below where values in adjacent cells in different column are equal to each other. Steven Rosenberg Excel Programming 4 August 5th 03 05:05 AM


All times are GMT +1. The time now is 08:00 PM.

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"