Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Mark 688
 
Posts: n/a
Default Getting a macro to see the next available empty cell

One of my sheets has several identical forms with different data in the
cells. There is a button on each form linking that sheet to another. When I
press that button it goes to the other sheet and autofill 3 cells from the
previous sheet and form. What I need to do, as the new sheet has space for
multiple entries, is when I click the button from another form it recognises
that data already exists in the 3 cells and automatically fills the next 3
available unprotected cells. I have been at this for weeks and I am unable
to find a solution in the help file. Much obliged to any assistance.

Mark
  #2   Report Post  
Gary''s Student
 
Posts: n/a
Default

This tiny macro locates the "first" empty cell in a range and returns its row
number. If you call it with the range as a column, it will locate the first
empty cell in the column-range. Once you have the row of the empty cell do
Cells(i,j).Select
where i comes from the function. Then you can do the election paste.

Function FindIt(R As Range) As Long
Dim l As Range
FindIt = 0
For Each l In R
If FindIt = 0 Then
If l.Value = "" Then
FindIt = l.Row
End If
End If
Next
End Function
--
Gary''s Student


"Mark 688" wrote:

One of my sheets has several identical forms with different data in the
cells. There is a button on each form linking that sheet to another. When I
press that button it goes to the other sheet and autofill 3 cells from the
previous sheet and form. What I need to do, as the new sheet has space for
multiple entries, is when I click the button from another form it recognises
that data already exists in the 3 cells and automatically fills the next 3
available unprotected cells. I have been at this for weeks and I am unable
to find a solution in the help file. Much obliged to any assistance.

Mark

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
Macro to copy value in empty cells Esrei Excel Discussion (Misc queries) 3 April 19th 05 03:54 PM
macro to look for empty cell esrei Excel Discussion (Misc queries) 1 April 14th 05 11:57 AM
In Bar Chart, can we display both figures and their respective %a. Airtel Excel Discussion (Misc queries) 3 March 9th 05 02:35 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro to hide rows with empty cells tp58tp Excel Worksheet Functions 2 November 13th 04 02:01 PM


All times are GMT +1. The time now is 01:00 AM.

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

About Us

"It's about Microsoft Excel"