|
|
Return All Sheets to Cell A1 before save
Hi
I have a workbook which comprises 11 worksheets. Before saving the workbook,
I would like to return all sheets to cell A1 except for two worksheets - one
called "Database-address" and the other "Database - Name" which asre to be
returned to cells A4 and A6 respectively.
How can I do this with vba code.
Thanks
Darryl
|
|
0
|
|
|
|
Reply
|
Darryl
|
11/30/2009 10:09:49 PM |
|
Darryl
Place this macro in the ThisWorkbook module. Note that you have to have
2 sheets named exactly as they are named in this macro, spaces and all. HTH
Otto
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Select
If ws.Name <> "Database-address" And ws.Name <> "Database - Name"
Then
Range("A1").Select
Else
If ws.Name = "Database-address" Then Range("A4").Select
If ws.Name = "Database - Name" Then Range("A6").Select
End If
Next ws
End Sub
"Darryl" <darryl4452@internode.on.net> wrote in message
news:009dc736$0$26854$c3e8da3@news.astraweb.com...
> Hi
>
> I have a workbook which comprises 11 worksheets. Before saving the
> workbook, I would like to return all sheets to cell A1 except for two
> worksheets - one called "Database-address" and the other "Database - Name"
> which asre to be returned to cells A4 and A6 respectively.
>
> How can I do this with vba code.
>
> Thanks
>
> Darryl
>
>
|
|
0
|
|
|
|
Reply
|
Otto
|
11/30/2009 11:35:30 PM
|
|
Put this in the ThisWorkbook module and change sheet names and range to
suit.
Private Sub Workbook_BeforeSave _
(ByVal SaveAsUI As Boolean, Cancel As Boolean)
sheets.Select
Range("a1").Select
Application.Goto sheets("sheet2").Range("a6")
Application.Goto sheets("sheet3").Range("a8")
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"Darryl" <darryl4452@internode.on.net> wrote in message
news:009dc736$0$26854$c3e8da3@news.astraweb.com...
> Hi
>
> I have a workbook which comprises 11 worksheets. Before saving the
> workbook, I would like to return all sheets to cell A1 except for two
> worksheets - one called "Database-address" and the other "Database - Name"
> which asre to be returned to cells A4 and A6 respectively.
>
> How can I do this with vba code.
>
> Thanks
>
> Darryl
>
>
|
|
0
|
|
|
|
Reply
|
Don
|
11/30/2009 11:39:11 PM
|
|
|
2 Replies
440 Views
(page loaded in 0.77 seconds)
Similiar Articles: Return All Sheets to Cell A1 before save - microsoft.public.excel ...Hi I have a workbook which comprises 11 worksheets. Before saving the workbook, I would like to return all sheets to cell A1 except for two works... How do I link cells between to sheets in MS Excel? - microsoft ...How do I find text among multiple worksheets and return the cell ... Return All Sheets to Cell A1 before save - microsoft.public.excel ... Do you change into your cape ... Change currency on all sheets based on one cell value - microsoft ...I have a cell (Inputs!A1) which updates to 1 for euro country and 2 for the UK. ... Change currency on all sheets based on one cell value - microsoft ... cell value to ... Save spreadsheet using cell values as filename - microsoft.public ...Return All Sheets to Cell A1 before save - microsoft.public.excel ... Save spreadsheet using cell values as filename - microsoft.public ... Return All Sheets to Cell A1 ... Enter key moves to cell below current, not to beginning of data ...... if I add data to cells A1 ... to the end, then press return it will put you below the cell ... csv file then > saving it as Excel format before adding more sheets). Macro to rename Tab and then save as - microsoft.public.excel ...Macro to rename Tab and then save as - microsoft.public.excel ... Rename Worksheet Tab as File Name Using a Macro ... macros ... Sheets to Cell A1 before save ... macro using cell value - microsoft.public.excel.miscName a worksheet tab based on the value in a cell. - microsoft ... Rename Worksheet Tab as File Name Using a Macro ... macros ... Sheets to Cell A1 before save - microsoft ... Linking worksheet and multiple cells - microsoft.public.excel ...... Column A in all 3 worksheets. So, if A1 ... among multiple worksheets and return the cell ... cape first before saving me ... How do I find text among multiple worksheets and ... Copy Excel Worksheet to new Workbook via VBA without Links to ...... Worksheets("Work Sheet A").Copy Before:=Workbooks ... Book.xls").Worksheets("Work Sheet A").Range("a1:z100").Activate ' Remove Links and Replace with Cell ... Save the value ... Cell entry - microsoft.public.excel.worksheet.functions ...... on sheet 1 at A1, B1, & C1, whcih will be again save on sheet 2 at A3, B3, & C3 and so on. Means input cell (A1 ... through the tip first, at a small angle of entry, before ... Return All Sheets to Cell A1 before save - microsoft.public.excel ...Hi I have a workbook which comprises 11 worksheets. Before saving the workbook, I would like to return all sheets to cell A1 except for two works... Return All Sheets to Cell A1 before save ExcelHi I have a workbook which comprises 11 worksheets. Before saving the workbook, I would like to return all sheets to cell A1 except for two worksheets - Variable Excel Worksheet Names in Excel Formulas. Sheet Name In Cell... Worksheet names and have one single formula able to return results from all Worksheets. ... =CELL("filename",A1) the Worksheet name will ALWAYS be the current active ... Julian's Excel Macro (VBA) Tips for BeginnersTherefore always save your workbook before running any macros. ... Refer to Protecting all sheets macro which uses this ... In cell A1 type Income and in cell B1 type in ... Worksheets in VBA Coding and in Worksheet Formulas... Count) '-- place at end Sheets.Add Before ... Cycling through sheets looking for specific value in cell A1 (#search) ... Create folder and save file The ... 7/25/2012 5:49:09 PM
|
|
|
|
|
|
|
|
|