I googled and found:
Range("B4").End(xlUp).Select
This example selects the cell at the top of column B in the region that contains cell B4.
Robert
And I found this:
Describes how to use VBA macros or procedures to select cells, ranges, and named ranges in Excel. ... Count to count the number of columns in the specified item. Rows. .... Column lastRow = ActiveSheet.Cells(65536, lastCol).End(xlUp).Row
How do i call a procedure
Moderator: Rathinagiri
- mol
- Posts: 3455
- Joined: Thu Sep 11, 2008 5:31 am
- Location: Myszków, Poland
- Has thanked: 282 times
- Been thanked: 182 times
- Contact:
-
- Posts: 238
- Joined: Thu May 25, 2017 6:30 pm
- DBs Used: DBF
- Location: D 83071 Stephanskirchen
- Has thanked: 82 times
- Been thanked: 30 times
Now the problem is solved:
I simply added Mol's #define
and left out the line oExcel:Cells:Item(65536, nColumn).Select()
Now it works.
Thank you for your answers.
Robert
I simply added Mol's #define
and left out the line oExcel:Cells:Item(65536, nColumn).Select()
Now it works.
Thank you for your answers.
Robert
-
- Posts: 238
- Joined: Thu May 25, 2017 6:30 pm
- DBs Used: DBF
- Location: D 83071 Stephanskirchen
- Has thanked: 82 times
- Been thanked: 30 times
Sorry, my answer was given too quick, not all rows are appended,
but when I insert:
oExcel:Cells:Item(65536, nColumn).Select()
I get a syntax error.
I will search the net for a solution (VBA), if I find it I will post it here.
Thx again
Robert
but when I insert:
oExcel:Cells:Item(65536, nColumn).Select()
I get a syntax error.
I will search the net for a solution (VBA), if I find it I will post it here.
Thx again
Robert
-
- Posts: 238
- Joined: Thu May 25, 2017 6:30 pm
- DBs Used: DBF
- Location: D 83071 Stephanskirchen
- Has thanked: 82 times
- Been thanked: 30 times
Hi Marek,
the syntax error is gone, but I still get a runtime error (tole)
As a workaround i did the following:
manually open worksheet, find the last row with ctrl end, type this in a cell above the range to be imported and read it into nLastRow.
But I will search for an automatic solution.
the syntax error is gone, but I still get a runtime error (tole)
As a workaround i did the following:
manually open worksheet, find the last row with ctrl end, type this in a cell above the range to be imported and read it into nLastRow.
But I will search for an automatic solution.
- mol
- Posts: 3455
- Joined: Thu Sep 11, 2008 5:31 am
- Location: Myszków, Poland
- Has thanked: 282 times
- Been thanked: 182 times
- Contact:
You have to know which row is occupied by data?
I'm testing first cell in row while importing data if it's not empty. If it doesn't contain any value, I'm finishing process.
I'm testing first cell in row while importing data if it's not empty. If it doesn't contain any value, I'm finishing process.
Code: Select all
nRow := 1
do while .t.
DO EVENTS
xCell :=oXLSSheet:Cells( nRow, 3 ):Value
if empty(xCell)
exit
endif
nRow++
enddo