|
-
October 4th, 2009, 11:45 AM
#1
Text1 to excel
Hello everybody,
I need your help again on this code:
Code:
Dim xlExcel As New Excel.Application
xlExcel.ActiveWorkbook.Sheets(1).Cells(2, 4).Value = Text1.Text
xlExcel.Application.DisplayAlerts = False
xlExcel.ActiveWorkbook.SaveAs "C:\Documents and Settings\test.xls"
xlExcel.ActiveWorkbook.Close
xlExcel.Quit
Set xlExcel = Nothing
I would like the code to found in column 4 the last value insert, and right down the new value in the first empty cell just under.
How can I do this please?
Thanks again.
-
October 4th, 2009, 11:53 AM
#2
Re: Text1 to excel
I don't understand. That looks like it changes (2,4) to Text1
-
October 4th, 2009, 12:14 PM
#3
Re: Text1 to excel
Yes, you are right,
But now, I want to change it to the first cell that is empty in column 4, starting from line 2, going down.
-
October 4th, 2009, 02:18 PM
#4
Re: Text1 to excel
You can use either of these technioques to determine the last used row/cell. It best to go from the bottom up as if you go from the top down it may not be the last used cell as it only looks at empty cells.
Code:
Dim oRange As Range
Set oRange = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell)
MsgBox oRange.Address
'Or
MsgBox Range("D65536").End(xlUp).Row + 1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|