Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can not delete one row in Excel
Message
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01127631
Message ID:
01127649
Views:
11
This message has been marked as the solution to the initial question of the thread.
Process it backwards because row numbering changes every time you delete a row
for lnRow = m.lnRows to 1 STEP -1
>>
oSheet.Rows(lnRow).Delete()
>>
>Even this didn't work! I don't really understand, why! BTW, for Columns would it be Columns(m.lnCols).Delete ?
>
>Here is my code where loSheet is defined before with loSheet construct:
>
>
>*-- Find total # of used rows
>				for lnRow = 1 to m.lnRows
>					llValFound = .f.
>					for lnCol = 1 to m.lnCols
>						lcCellValue = .Cells(m.lnRow,m.lnCol).value
>						if not (empty(m.lcCellValue) or isnull(m.lcCellValue))
>							llValFound = .t.
>							exit
>						endif
>					next
>					if !m.llValFound
>						.Rows(m.lnRow).Delete()						
>						lnFinalRows = m.lnFinalRows - 1
>					endif
>				next
>
>				lnRows = m.lnFinalRows &&.UsedRange.rows.count
>
>*-- Find total # of used columns
>				for lnCol = 1 to m.lnCols
>					llValFound = .f.
>					for lnRow = 1 to m.lnRows
>						lcCellValue = .Cells(m.lnRow,m.lnCol).value
>						if not (empty(m.lcCellValue) or isnull(m.lcCellValue))
>							llValFound = .t.
>							exit
>						endif
>					next
>					if !llValFound
>						.Columns(m.lnCols).delete()
>						lnFinalCols = m.lnFinalCols - 1
>					endif
>				next
>
>At the end of all processes I made Excel visible and I still see this empty row, that should have been deleted.
>
>I'm banging my head on this particular Excel trying to convert it to DBF for the second day in a row :(
>
>Thanks again.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform