Delete a row in Excel worksheet from VB program 
Author Message
 Delete a row in Excel worksheet from VB program

Hi everybody,
My VB application will generate data to pre-format Excel worksheet. But
in some situations, I wish to delete a row or a column in the pre-
format worksheet which I do not want it apppear in the Excel Report.
How do I code my VB program to perform this task ? May someone help me ?

Thanks in advance.
G.H.

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sat, 31 Aug 2002 03:00:00 GMT  
 Delete a row in Excel worksheet from VB program

Quote:

> Hi everybody,
> My VB application will generate data to pre-format Excel worksheet. But
> in some situations, I wish to delete a row or a column in the pre-
> format worksheet which I do not want it apppear in the Excel Report.
> How do I code my VB program to perform this task ? May someone help me ?

> Thanks in advance.
> G.H.

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Try this to delete column D:

    Columns("D:D").Delete Shift:=xlToLeft  

By the way, to figure out VBA code for anything in Excel, use the
Macro Recorder (Tools/Macro/Record New Macro; do whatever you want
to do; hit the Stop button. Then Tolls/Macro/Macros/Edit to see the
VBA code generated).  You will usually have to make some small changes,
but this will give you the general idea. When I did the above, it gave
me:

    Columns("D:D").Select
    Selection.Delete Shift:=xlToLeft

I happen to know what using .select and selection. causes Excel to
create a Range object behind the scenes, and Excel won't really close
when the user closes it (as long as the app that created it is still
open), so I don't use them; you can usually put the lines together
and remove the Select stuff.

Robin
nightingale at home don't spamme dammit dot com



Sun, 01 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Deleting Rows Across Multiple Excel Worksheets

2. Insert Blank Row Into Excel Worksheet with VB

3. Deleting a created Excel worksheet in VB...

4. Add Row to Excel Worksheet

5. processing excel rows - separate workbooks/worksheets

6. excel: undo vb-code selectionchange when delete row

7. excel 97: undo VB-code selectionchange when delete row

8. Excel: undo VB-code selectionchange when delete row

9. deleting worksheet in excel workbook

10. Can't delete record from Excel Worksheet

11. VBasic macro to delete worksheet from within Excel

12. Worksheet delete using Excel as OLE server

 

 
Powered by phpBB® Forum Software