Save Data By Date

  • Thread starter Thread starter Stuart Smith
  • Start date Start date
S

Stuart Smith

1. I would to import a csv file each day and have it fill certain cells and
perform calculations
such as a daily balancing sheet would do.
2. Then I would like to have a macro assigned to a control button that would
look at the system date and name as save the Excel file by that date.

Anyone have any ideas on how to start this project???

Stuart
(e-mail address removed)
 
I use this

Sub saveme()
Dim wSheet As Worksheet
'Name Tab
UnProtectSheet
Application.EnableEvents = False
Application.ScreenUpdating = False
Start
Range("K1").Copy
Range("K1").PasteSpecial xlPasteValues
ActiveSheet.Name = Format(Range("K1").Value, "#")
Dim varfilestring, Testdate, EXIT1, EXIT2
varfilestring = vbNullString
Testdate = Range("r5")
If (Testdate) = "0" Then GoTo EXIT1
If (Testdate) <> -1 Then GoTo EXIT2
EXIT1:
MsgBox "No Valid Date Entered", vbOKOnly, "Date Error"
Range("A1:w59").Select
ActiveWindow.Zoom = True
Exit Sub
EXIT2:
Application.DisplayAlerts = False
varfilestring = Range("n4") & Range("k1") & " " & Range("B118") & " "
"for " & Format(Range("r5"), "dd-mm-yy") & ".xls"
ActiveWorkbook.SaveAs varfilestring, FileFormat:=xlNormal
password:="", WriteResPassword:="", ReadOnlyRecommended:=False
CreateBackup:=True
Range("B2").Select
Application.ScreenUpdating = True
UNDONE
Set wSheet = Nothing
Exit Sub
Application.EnableEvents = True
ProtectSheet
End Sub



The area you should be interested in is
varfilestring = Range("n4") & Range("k1") & " " & Range("B118") & " "
"for " & Format(Range("r5"), "dd-mm-yy") & ".xls"
ActiveWorkbook.SaveAs varfilestring, FileFormat:=xlNormal
password:="", WriteResPassword:="", ReadOnlyRecommended:=False
CreateBackup:=True


n4 is path i.e "e:\manning\" without quotes
k1 is a title " "
B118 is a text string
R5 is a date string for my purposes formatted as *14 March 2001 as i
the date example of format
the close makes it an .xls file

I run this from a VBA button on the sheet which triggers the macr
 
See at least one response to your other post.

Stuart said:
1. I would to import a csv file each day and have it fill certain cells and
perform calculations
such as a daily balancing sheet would do.
2. Then I would like to have a macro assigned to a control button that would
look at the system date and name as save the Excel file by that date.

Anyone have any ideas on how to start this project???

Stuart
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top