View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
DGolds DGolds is offline
external usenet poster
 
Posts: 7
Default Name the ActiveCell

Hi,
This code should do the trick (assuming you're looking for the first blank
row in Col A):

Dim lRow As Integer
Dim myRng As Range
lRow = Range("A" & Rows.Count).End(xlUp).Row
Set myRng = Range("A" & lRow + 1)
'Your code here.
Destination:=myRng
HTH,
Dave

"Vikxcel" wrote:


Ok, either i'm loosing it or i'm doing something wrong.

Hi everyone.

So here's my problem, i have a code where it imports a .csv file into
my worksheet, it all works fine because i tell it to use cell A2 as the
destination:

-With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\p rogram
files\transmitt-xls\combined.csv", _
Destination:=Range(A2)) -

But, if i do the import again, it will move everything in there
currently to the right and will still use the A2 Cell, so now i'm
thinking how to make it check for the last empty cell and use that as
the destination.
I have this:

-Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True-

but how do i name that last empty cell and then use that in the
destination? or what am i doing wrong????
Thanks,
Viktor.


--
Vikxcel
------------------------------------------------------------------------
Vikxcel's Profile: http://www.excelforum.com/member.php...o&userid=18607
View this thread: http://www.excelforum.com/showthread...hreadid=477365