Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
david
 
Posts: n/a
Default macro to save file automaticaly?

I already have a button with a macro to hide the empty rows. With this same
button I want to save the file automatically after the rows are hidden. The
name of the saved file should be the word in cell (€œsheet3€ €œA1€).

The first macro works the second doesnt.

Can someone please help me to fix the second and to combine the to.

Thanks!!!


Private Sub CommandButton1_Click()

Dim X As Integer

For X = 5 To 150

If Cells(X, 1).Value = 0 Then
Rows(X).Hidden = True
End If

Next X
End Sub


Sub SaveArchive()

ArchivePath = "Z:\david\werkbonnen\"
WorkBookName = Worksheets(€œprint€).Range(€œA1€).Value

FName = ArchivePath + WorkBookName
ActiveWorkbook.SaveAs Filename:=FName
End Sub

  #2   Report Post  
Davie
 
Posts: n/a
Default

When I paste you code into a macro sheet the '' '' around print and A1 each
become a pair of 's. That is
you should always use Shift and the 2 key from the alpha part (double quote)
of your keyboard rather than ' (single quote) twice. That might not be the
problem but why else would it change for my copy and paste of your code?



david wrote in message
...
I already have a button with a macro to hide the empty rows. With this same
button I want to save the file automatically after the rows are hidden. The
name of the saved file should be the word in cell (€œsheet3€ €œA1€).

The first macro works the second doesnt.

Can someone please help me to fix the second and to combine the to.

Thanks!!!


Private Sub CommandButton1_Click()

Dim X As Integer

For X = 5 To 150

If Cells(X, 1).Value = 0 Then
Rows(X).Hidden = True
End If

Next X
End Sub


Sub SaveArchive()

ArchivePath = "Z:\david\werkbonnen\"
WorkBookName = Worksheets(€œprint€).Range(€œA1€).Value

FName = ArchivePath + WorkBookName
ActiveWorkbook.SaveAs Filename:=FName
End Sub



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
How to stop getting the file save box when running a macro Pank Mehta Excel Discussion (Misc queries) 1 March 29th 05 04:05 PM
Excell2003 (SP-1) File > Save and File > Save As.. grayed out Joe Murphy Excel Discussion (Misc queries) 0 March 9th 05 10:00 PM
Save & Save As features in file menu of Excel Blue Excel Discussion (Misc queries) 9 December 27th 04 08:49 PM
This one is tricky....Macro to save file as cell value x in di Andy Excel Discussion (Misc queries) 4 November 26th 04 08:52 AM
Macro did not run after download file from net ariffin Excel Worksheet Functions 2 November 6th 04 01:20 AM


All times are GMT +1. The time now is 03:58 AM.

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"