ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Finding Row (https://www.excelbanter.com/excel-discussion-misc-queries/89298-finding-row.html)

fak119

Finding Row
 
Is there an easy way (Macro) to go to the next empty row or column?

Don Guillett

Finding Row
 
next
nr=cells(activecell.row,activecell.column).end(xld own).row+1
or better yet
lr=cells(rows.count,activecell.column).end(xlup).r ow+1

--
Don Guillett
SalesAid Software

"fak119" wrote in message
...
Is there an easy way (Macro) to go to the next empty row or column?




fak119

Finding Row
 
Do I simply enter this last line into any Macro?

"Don Guillett" wrote:

next
nr=cells(activecell.row,activecell.column).end(xld own).row+1
or better yet
lr=cells(rows.count,activecell.column).end(xlup).r ow+1

--
Don Guillett
SalesAid Software

"fak119" wrote in message
...
Is there an easy way (Macro) to go to the next empty row or column?





Dave Peterson

Finding Row
 
Yep. Then you can use it any way you want.

Option Explicit
sub testme()
dim LR as long
with activesheet
lr = .cells(.rows.count,activecell.column).end(xlup).ro w + 1
.cells(lr,"A").value = "Hi there"
.cells(lr,activecell.column).value = "Bye there"
end with
end sub

Don used the activecell to find the next row. I think I would look at my data
and pick out a column that always has data--say column A:

So the line of code becomes:
lr = .cells(.rows.count,"a").end(xlup).row + 1






fak119 wrote:

Do I simply enter this last line into any Macro?

"Don Guillett" wrote:

next
nr=cells(activecell.row,activecell.column).end(xld own).row+1
or better yet
lr=cells(rows.count,activecell.column).end(xlup).r ow+1

--
Don Guillett
SalesAid Software

"fak119" wrote in message
...
Is there an easy way (Macro) to go to the next empty row or column?





--

Dave Peterson


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

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