Hi people,
I need your help to improve my Excel sheet.
I use some small macros to save the file with a specific name in a specific folder, determined by variables.
In colum S you’ll find the Directory where macro should save the Excel file and the PDF file.
Also, you’ll find the file name which is composed of the content of several cells.
The Macro SaveOFFER() look into the sheet OFFRE, in column S where are info.
The problem is that I would like to move the content of the column R and S from the sheet OFFRE into the sheet PARAM so I’m more flexible if I add lines or columns.
I can’t find the way to say in the macro that it has to look into another sheet to print or save the file…
Here is the macro:
Sub SaveOFFER()
'-----------------------------------------------------------------------------------------------------------+
' Sauvegarde l'offre dans le répertoire facturation avec le bon nom de fichier
'-----------------------------------------------------------------------------------------------------------+
Range("C3").Select
ChDir Range("S6")
ActiveWorkbook.SaveAs Filename:=Range("S6") & Range("S7")
Explanation of what I need:
Range("C3").Select
Here it should go to Param!C3 instead of just C3
ChDir Range("S6")
Here it should go to Offre!S6 instead of just S6
ActiveWorkbook.SaveAs Filename:=Range("S6") & Range("S7")
Here it should stay in the sheet OFFRE, but use the value stored in Param!S6 and Param!S7 instead of just S6 and S7.
I hope that it’s clear. If not, ask me and I can send a copy of the Excel file I use...
Any better solution, is welcome.
Another solution could be that if I move anywhere the content of column R + S, the macro would also change it’s value. I don’t know if it’s possible in VBA to have dynamic references.
In Excel, when you move a the content of any cell that is in a formula, the formula is automatically adapted to the new location. What about VBA?
Thank you very much for your valuable help!
Best regards!
I need your help to improve my Excel sheet.
I use some small macros to save the file with a specific name in a specific folder, determined by variables.
In colum S you’ll find the Directory where macro should save the Excel file and the PDF file.
Also, you’ll find the file name which is composed of the content of several cells.
The Macro SaveOFFER() look into the sheet OFFRE, in column S where are info.
The problem is that I would like to move the content of the column R and S from the sheet OFFRE into the sheet PARAM so I’m more flexible if I add lines or columns.
I can’t find the way to say in the macro that it has to look into another sheet to print or save the file…
Here is the macro:
Sub SaveOFFER()
'-----------------------------------------------------------------------------------------------------------+
' Sauvegarde l'offre dans le répertoire facturation avec le bon nom de fichier
'-----------------------------------------------------------------------------------------------------------+
Range("C3").Select
ChDir Range("S6")
ActiveWorkbook.SaveAs Filename:=Range("S6") & Range("S7")
Explanation of what I need:
Range("C3").Select
Here it should go to Param!C3 instead of just C3
ChDir Range("S6")
Here it should go to Offre!S6 instead of just S6
ActiveWorkbook.SaveAs Filename:=Range("S6") & Range("S7")
Here it should stay in the sheet OFFRE, but use the value stored in Param!S6 and Param!S7 instead of just S6 and S7.
I hope that it’s clear. If not, ask me and I can send a copy of the Excel file I use...
Any better solution, is welcome.
Another solution could be that if I move anywhere the content of column R + S, the macro would also change it’s value. I don’t know if it’s possible in VBA to have dynamic references.
In Excel, when you move a the content of any cell that is in a formula, the formula is automatically adapted to the new location. What about VBA?
Thank you very much for your valuable help!
Best regards!