How do i call a procedure
Moderator: Rathinagiri
Re: How do i call a procedure
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
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
Re: How do i call a procedure
xlUp is defined in excel.ch as:
Code: Select all
#DEFINE xlUp -4162
Re: How do i call a procedure
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
Re: How do i call a procedure
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
Re: How do i call a procedure
change:
oExcel:Cells:Item(65536, nColumn).[/b]Select()
to
oExcel:Cells:Item(65536, nColumn):Select()
oExcel:Cells:Item(65536, nColumn).[/b]Select()
to
oExcel:Cells:Item(65536, nColumn):Select()
Re: How do i call a procedure
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.
Re: How do i call a procedure
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
Re: How do i call a procedure
The problem is: the xls-sheet is provided by a report generator from another company and there are empty lines before the last line with data.