Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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


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
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
activecell slikity Excel Programming 7 December 13th 04 11:59 AM
use of activecell inquirer Excel Programming 8 May 16th 04 06:39 AM
Activecell value Shamsul Islam Excel Programming 5 April 30th 04 10:10 PM
how to set activecell? ljb[_2_] Excel Programming 2 November 18th 03 04:49 PM


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

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"