LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default VB Help If Statement in Selection.ShowDetail = True

Hello,
I have recorded almost what I need and hoped you guys here would be able to
help me. This Macro will
Drill down into 8 specifically placed pivot tables on a single worksheet,
and save the individual files to c:\test.csv

The macro works if every pivot table has data, but if its blank it fails.
Also, i need help in making the file names change. It could be previous +1
or anything as long as there is never a duplicate..
Here is the macro.

Sub getdata()
'
' getdata Macro
'
' Keyboard Shortcut: Ctrl+q
'
Range("C7").Select
Selection.ShowDetail = True
ChDir "C:\test"
ActiveWorkbook.SaveAs Filename:="C:\test\1.csv", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveSheet.Next.Select
Range("F7").Select
Selection.ShowDetail = True
ActiveWorkbook.SaveAs Filename:="C:\test\2.csv", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveSheet.Next.Select
Range("I7").Select
Selection.ShowDetail = True
ActiveWorkbook.SaveAs Filename:="C:\test\3.csv", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveSheet.Next.Select
Range("L7").Select
Selection.ShowDetail = True
ActiveWorkbook.SaveAs Filename:="C:\test\4.csv", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveSheet.Next.Select
Range("O7").Select
Selection.ShowDetail = True
ActiveWorkbook.SaveAs Filename:="C:\test\5.csv", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveSheet.Next.Select
Range("R7").Select
Selection.ShowDetail = True
ActiveWorkbook.SaveAs Filename:="C:\test\6.csv", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveSheet.Next.Select
Range("U7").Select
Selection.ShowDetail = True
ActiveWorkbook.SaveAs Filename:="C:\test\7.csv", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveSheet.Next.Select
Range("X7").Select
Selection.ShowDetail = True
ActiveWorkbook.SaveAs Filename:="C:\test\8.csv", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveSheet.Next.Select
ActiveWindow.Close
End Sub
 
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
TRUE/FALSE STATEMENT Dave Excel Discussion (Misc queries) 4 September 1st 09 11:55 AM
Deleting Duplicate Rows In a Selection with a True Statement Josh heep Excel Programming 2 February 13th 08 07:37 PM
Two TRUE to one FALSE statement bluebird Excel Worksheet Functions 4 January 11th 07 04:07 PM
If then statement with two true conditions Don Guillett[_4_] Excel Programming 0 October 16th 04 12:01 AM
Run Macro on true statement Jack S. Excel Programming 2 August 10th 04 05:19 PM


All times are GMT +1. The time now is 08:34 PM.

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

About Us

"It's about Microsoft Excel"