Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Number of exportet rows/columns

Hi,

I'm exporting table charts to excel via macro. Is it possible to get the number of the exported rows and columns?
I'd like to do a specific cell formatting in the cells that contain data.

Thanks for your help

Aloah

2 Replies
Not applicable
Author

Found the solution: XLSheet.Cells.SpecialCells(11).Row

🙂

Not applicable
Author

Try it

sub ToExcel
........
iCol= XLSheet.UsedRange.Columns.Count
iRow = XLSheet.UsedRange.Rows.Count
Call RefToColl(iCol, sLett)
............
end sub

'*************************************************************************
'* Per calcolare ultima colonna in excel
'*************************************************************************
function RefToColl(iCol, sLett)
aCol1 = iCol
slett = ""
if icol > 26 then
aCol1 = iCol -26
sLett = "A"
end if
if icol > 52 then
aCol1 = iCol -52
sLett = "B"
end if
if icol > 78 then
aCol1 = iCol -78
sLett = "C"
end if
if icol > 104 then
aCol1 = iCol -104

sLett = "D"
end if
Slett = SLett + Chr(65 + ACol1 - 1)
MsgBox("columns " &Acol&" Lettera "&slett)
end Function

Ciao! Wink

Daniela