Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default One Macro Does All


I did manage to do this myself by recording the macro to save eac
workbook and adding it after the original code i had

Sub delete_rows()
Dim RowNdx As Long
Dim LastRow As Long
LastRow = ActiveSheet.Cells(Rows.Count, "D").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "D").Value = " v " Then
Rows(RowNdx).Delete
End If
Next RowNdx
Sheets("Sheet2").Select
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\scott\My Documents\evt_test.csv"
FileFormat:= _
xlCSV, CreateBackup:=False
Sheets("Sheet3").Select
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\scott\My Documents\mkt_test.csv"
FileFormat:= _
xlCSV, CreateBackup:=False
Sheets("Sheet4").Select
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\scott\My Documents\SEL_TEST.csv"
FileFormat:= _
xlCSV, CreateBackup:=False

End Sub


So this deletes rows with " v " in column d then save the other
worksheets just as i wanted butit only deletes the cells with "v " i
the sheet i am open and i want it to go through sheets 2, 3 & 4 an
delete the rows with " v " in as well, what can i add for it to d
that, im guessing its something to do with this line ??

LastRow = ActiveSheet.Cells(Rows.Count, "D").End(xlUp).Row

Where it says active sheet how do i get it to check sheet 2,3 and 4 ??

Thank

--
scottymellot
-----------------------------------------------------------------------
scottymelloty's Profile: http://www.excelforum.com/member.php...nfo&userid=380
View this thread: http://www.excelforum.com/showthread.php?threadid=27148

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default One Macro Does All

The code works fine for me and does exactly what you decribed. If you get
such an error, try closing excel and rebooting then run it again. There is
nothing in the code that would cause that error - that is some bug in Excel.

In any event, the code also shows you how to process each sheet. If you
can't derive how it is done from looking at the code, there is no sense
asking for someone to repeat it.

--
Regards,
Tom Ogilvy

"scottymelloty" wrote in
message ...

I did manage to do this myself by recording the macro to save each
workbook and adding it after the original code i had

Sub delete_rows()
Dim RowNdx As Long
Dim LastRow As Long
LastRow = ActiveSheet.Cells(Rows.Count, "D").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "D").Value = " v " Then
Rows(RowNdx).Delete
End If
Next RowNdx
Sheets("Sheet2").Select
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\scott\My Documents\evt_test.csv",
FileFormat:= _
xlCSV, CreateBackup:=False
Sheets("Sheet3").Select
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\scott\My Documents\mkt_test.csv",
FileFormat:= _
xlCSV, CreateBackup:=False
Sheets("Sheet4").Select
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\scott\My Documents\SEL_TEST.csv",
FileFormat:= _
xlCSV, CreateBackup:=False

End Sub


So this deletes rows with " v " in column d then save the other 3
worksheets just as i wanted butit only deletes the cells with "v " in
the sheet i am open and i want it to go through sheets 2, 3 & 4 and
delete the rows with " v " in as well, what can i add for it to do
that, im guessing its something to do with this line ??

LastRow = ActiveSheet.Cells(Rows.Count, "D").End(xlUp).Row

Where it says active sheet how do i get it to check sheet 2,3 and 4 ??

Thanks


--
scottymelloty
------------------------------------------------------------------------
scottymelloty's Profile:

http://www.excelforum.com/member.php...fo&userid=3808
View this thread: http://www.excelforum.com/showthread...hreadid=271487



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"