Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Name the ActiveCell
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 int my worksheet, it all works fine because i tell it to use cell A2 as th destination: -With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\p rogra files\transmitt-xls\combined.csv", _ Destination:=Range(A2)) - But, if i do the import again, it will move everything in ther currently to the right and will still use the A2 Cell, so now i' thinking how to make it check for the last empty cell and use that a 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 th destination? or what am i doing wrong???? Thanks, Viktor -- Vikxce ----------------------------------------------------------------------- Vikxcel's Profile: http://www.excelforum.com/member.php...fo&userid=1860 View this thread: http://www.excelforum.com/showthread.php?threadid=47736 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
If activecell.column = variable then activecell,offset (0,1) | Excel Discussion (Misc queries) | |||
activecell | Excel Programming | |||
use of activecell | Excel Programming | |||
Activecell value | Excel Programming | |||
how to set activecell? | Excel Programming |