View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Celt Celt is offline
external usenet poster
 
Posts: 1
Default help locating first empty cell in a column


I am looking for a function that will search column A and return th
address of the first blank cell. I have been trying to do this with a
Address & Match combo as follows:


=ADDRESS(MATCH(9.99999999999999E+307,A:A)+1,1)

Alone this formula works great. However, when I put it in a macro, i
doesn't work. Here is my macro:

ActiveWorkbook.Names.Add Name:="ABC", RefersToR1C1:= _
"=OFFSET(INDIRECT(ADDRESS(MATCH(""EML*"",Sheet1!C6 ,0),6)),0,-5,COUNTIF(Sheet1!C6,LEFT(""EML*"",5)),COUNTA(Sheet 1!R4))"
ActiveWorkbook.Names.Add Name:="EMPTY", RefersToR1C1:= _
"=ADDRESS(MATCH(9.99999999999999E+307,Sheet1!R1C1) + 1,1,4)"
Range("ABC").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A4").Select
ActiveSheet.paste
Range("EMPTY").Select

Basically the macro is taking "ABC" which is a specific chunk o
accounting data in a much larger pool of data from Sheet1 an
copy/pasting it to Sheet2. What I was hoping the macro would do i
then select the first empty cell in Column A under what I just pasted.

Visual Basic doesn't seem to like my "Empty" reference. The Debugge
pops up at Range("EMPTY").Select.

Anyone have any advice. Any help is much appreciated!!

--
Cel
-----------------------------------------------------------------------
Celt's Profile: http://www.excelforum.com/member.php...fo&userid=1941
View this thread: http://www.excelforum.com/showthread.php?threadid=46835