Change Name Of Worksheet On Open Without Macros
Aug 30, 2006
I'm trying to avoid using macros in my workbook, however, I'm unable to get my worksheets to change name (based on a named range) without use of them, as follows.
I've written the macro:
Sub MyMacro()
ActiveSheet.Name = Range("MyRange")
End Sub
and then dropped the following into the worksheet
Private Sub Worksheet_Activate()
Run "MyMacro"
End Sub
This works fine, but I'm trying to avoid using macros. When I try to place the following script in the worksheet private code, nothing happens:
Private Sub Worksheet_Activate()
ActiveSheet.Name = Range("MyRange")
End Sub
View 9 Replies
ADVERTISEMENT
Apr 18, 2013
I have a worksheet "OPEN", and would like to apply both:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim i As Long
Set rng = Target.Parent.Range("B:B")
If Target.Count > 1 Then Exit Sub
[Code] .........
The first removes the rows if the validated column 'B' is equal to "closed", to a second worksheet "CLOSED". The second orders the rows by the same column, followed by column 'A'. Being brand new to macros, I've no clue how to make this happen...
View 2 Replies
View Related
May 2, 2014
I have a file here that already has macros in it. The file is basically a excel document generator.
When you click create sku, the document will generate multiple documents based on the user inputs.
Two things in this file
1) In the generated documents the original "generator" file creates, I need generated files to have column B and D formatted to TEXT, currently all the generated files are formatted to general. (This code is in module 1, line 84 col 34.)
2) The other problem is I need to append the value in Cell N1 in the "sku data entry" sheet to be appended to the generated file names. (this part of the code is is in module 1, line 150 col 28.)
View 1 Replies
View Related
Oct 1, 2013
combine two Worksheet Change event macros into the one macro? The macros are listed below.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)On Error GoTo exitHandler
Dim rngDV As Range
Dim lRow As Long
Dim lCol As Long
[Code]...
exitHandler:
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("O:O")) Is Nothing Then
Application.EnableEvents = False
[Code]...
View 7 Replies
View Related
Apr 27, 2006
I have a formula that uses the OFFSET function so that subsequent row adds will automatically adjust the formulas. For example, cell A1 contains the value 1 and cell A2 contains the formula:
=offset(A2,-1,0) + 1
When I insert a row above row 2, the formula above adjusts to reference cell A3, which is what I want.
What I am running into is that when the workbook is opened, something in the workbook changes, causing the "Do you want to save the changes..." popup to appear even though all I do is immediately close the workbook.
I have traced the problem to my use of the OFFSET function, as when I change the formula to
=A2-1
and repeat the scenario, the workbook closes without the "save" popup.
Does the OFFSET function cause something to change (no cell values appear to have changed) and is there a way to get around this?
View 7 Replies
View Related
Aug 26, 2009
I have an Excel 2003 program that contains macros. One of the macros hides certain command bars and disables the worksheet menu bar. On close the opposite is true. The problem is, if a user uses the disable macros when opening then the worksheet menu bar and other command bars are still available. I would like to hide all of the data sheets and display another sheet that would normally be hidden displaying a message that the macros have to be enabled for the program to work correctly if disable macros is chosen. When the enable macros are used I would like the Error page to be hidden.
View 6 Replies
View Related
Dec 23, 2009
Does anyone know if it is possible to open an excel worksheet from excel VBA, without importing the macros from the worksheet being opened?
I have tried the following approach:
View 14 Replies
View Related
Feb 12, 2010
Is there any code that will automatically enable macros on Auto_Open?
View 6 Replies
View Related
Sep 13, 2006
I would like to when open a certain spreasheet it would perform a certain task.
View 3 Replies
View Related
Dec 9, 2008
Is there a way to prevent a workbook from opening unless macros are allowed?
View 2 Replies
View Related
Jun 11, 2014
I am trying to create a macro to add to a button that will open an embedded document (word, PPT, and excel).
I recorded the macro and it works fine the first time I try to test it but after it tells me that there is an error...
I'm not exactly sure what to do. Unfortunately, I could not find what I needed on youtube
Error: It talks about the object being out of range and allows me to debug... the code that is in the developer is:
Sub Macro1()
'
' Macro1 Macro
'
'
Sheets("Sheet2").Select
Windows("Worksheet in Book1").Visible = True
Selection.Verb Verb:=xlPrimary
ActiveWindow.Close
Sheets("Sheet1").Select
End Sub
The Windows line is what it tells me to fix.. from there I am lost... Is it because I am trying to do a double clicking function?
View 5 Replies
View Related
Mar 29, 2009
I have created an Excel Workbook and this Workbook has a VBA code that enforces an expiry date of the workbook (TimeBomb from cpearson.com). So, if the expiry date has passed, the workbook will not open. But since it is VBA related, the expiry date will work only if one has enabled macros. If macros are disabled, the workbook will open regardless of the date.
So, is there a way for Excel to check if macros are enabled? and is there a way for Excel not to open the workbook, if the macros are disabled?
View 10 Replies
View Related
Apr 21, 2009
i am trying to work out why i always have to enable macro's when i open some of my files that i have macros in, as i save them as enable macro file. I run excel 2007
as there are files i want to open without clicking on the enable button.
View 3 Replies
View Related
Nov 2, 2008
My son just upgraded my computer from 2000 to xp - a new application on a new hard drive. in the process, Excel was upgraded from 97 SR-1 to 97 SR-2.
My checkbook is on excel, and I really need to open it! We just moved to a new location, with the typical problems with email, internet etc.
I can open workbooks without macros. But I cannot open any with macros.
I get this message:
"Could not register the Visual Basic environment."
When that window is closed, the next one says:
"An error occured when initializing the VBA libraries (126)"
View 9 Replies
View Related
Jul 9, 2009
1- how can i open an xls file from a macros to get some data from it?
2- how can i set a wait function, till i press a special button before macros will be able to continue.
e.g.:
[macros.xla]
View 9 Replies
View Related
Apr 22, 2006
Is it possible to open a workbook via vba, but disable the macros? I know this sounds strange, but the workbook is coded to prevent users from saving it, and the only way to save it is to either open it with macros disabled or change the variable OKtoSave to true, but the variable is global only to the sheet and I can't find a way to change it through a macro written in my personal.xls workbook.
View 5 Replies
View Related
Mar 26, 2014
transferring data from a worksheet (Passdown Report) to another worksheet (Data Base) located in the same workbook. In the source worksheet (Passdown Report) there are 2 cells (B2 and D2) in which I would like the data to be transferred along with the data from B4 to AQ33. All the cells contain a formula which I want to stay after the information is transferred to the target worksheet (Data Base). This will be a daily transfer to the target worksheet (Data Base), so the macros should also identify the next available open row to transfer the data to.
View 1 Replies
View Related
Dec 20, 2013
I am facing an issue where my macro is unable to open multiple files and run the macros in it. Below is the code that i am using and it stops at boss1.
VB:
Sub allboss()
Call boss1
Call boss2
End Sub
[Code] .....
View 2 Replies
View Related
Oct 28, 2013
I'm posting a workbook on our network that I want to enable users to go in and update. I have the workbook designed, with entry fields for the data they need to enter, and they then push "Submit" to submit the new data to a hidden tracking log within the workbook.
Many of the users will be complete Excel newbies, and although I haven't posted the workbook yet, I am trying to anticipate possible issues. The first that comes to mind is that the user opening the workbook may not have macros enabled in their version of Excel, and they will get a message, and can't perform the udpate. Is there a way to add a Workbook Open event that automatically enable macros in the workbook when they open it, even if it is for this workbook only?
View 5 Replies
View Related
Feb 27, 2009
Everytime I open Excel, the personal.xls file opens. What does one need to do to have the personal.xls file available as an option to save macros to, and have it open in the background only - not as an active file you can see?
View 2 Replies
View Related
Jun 28, 2009
When I have a macro open another file, it always activates the macros in it. Is there some way to disable the macros?
View 11 Replies
View Related
Jul 30, 2009
I'd like to automatically run 1 of 4 macros depending on some criteria. Every workbook created has, unfortunately, the same worksheet name, so that leaves the only differences between the 4 possible loaded workbooks in the cells area and even those can be similiar in many ways. But....I found some criteria to separate all 4 workbooks...Here they are...
run macro 1 if this
1. Worksheet name says "Screen"
2. Cell H1 has the word "Lead"
run macro 2 if this
1. Worksheet name says "Screen"
2. Cell B1 has the word "records" somewhere in the cell
3. Cell H1 has the word "Lead"
run macro 3 if this
1. Worksheet name says "Screen"
2. Cell B1 has the word "records" somewhere in the cell
3. Cell N2 has the word "Delivered"
run macro 4 if this
1. Worksheet name says "Screen"
2. Cell B1 has the word "records" somewhere in the cell
3. Cell N2 has the word "Bevel"
I don't know if this can be done, but if so, that would be fantastic! I'm thinking that the macro would have to be "global" and in the user's personal workbook?
View 12 Replies
View Related
Feb 2, 2007
I have two macros, both written in "Module 1". I would like these both to run on the sheet named "profile" whenever any one or more cells in the sheet named "data" change in value. I have looked at the relevant FAQ's but unfortunately just don't have the experience with vba.
View 5 Replies
View Related
Jun 14, 2008
is it possible to write vb code to open the workbook, scroll through everysheet? extract the values from each worksheet?
let's just say, I only know the workbook name, but not the sheets of the name inside. So the vb code could scroll through every worksheet without knowing the worksheet name, only the workbook name(workbook.xls)
View 9 Replies
View Related
Jan 14, 2010
I have question about next worksheet, let say I have VB code that’s Run on sheet1, but Sheet2 to Sheet 7 al so needs after sheet1 finished, same format on at sheets.
View 9 Replies
View Related
Jan 10, 2014
i have some existing code which is trigerred when anything is input into column c. The code then adds various information in another three columns. One of which pastes a vlookup formulae, and i would like this forumlae pasted into the column c cell which i initialy edited, in order to remove the requirement for one additional column.
The existing code i have is:
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim MyText As String
MyText = Environ("username")
If Target.Cells.Column = 3 Then
With Target
If .Value "" Then
.Offset(0, 2).Formula = "=VLOOKUP(D:D,'P:TAOffshoreTAOffshoreTreasuryRecsGeneralCommit ID''s for control Sheet - Do not move or delete[commit ids - DO NOT DELETE OR MOVE.xls]Sheet1'!$A$1:$B$65536,2,0)"
[code].....
I have tried changing the offset to (0,0) or changing the offset to 'target = ', which does add in the vlookup but then the macro debugs at the 'If .Value "" Then' code?
View 3 Replies
View Related
Jun 17, 2009
an event macro to change the font colour of a cell whose value changes as a result of a calculation.
View 9 Replies
View Related
Jun 5, 2009
I need to protect the attached to stop people deleting the formulas. The problem is that there are hidden macros and when i protect the cells the conventional way they stop working and i lose all the data in the IAS sheet. I have highlighted all the cells in yellow that i want to be able to change once protected.
At this stage I would just like some one to explain how to protect it. Ideally I want to do it normally (unlock the cells individually that I want to remain unprotected, then protect the whole sheet). If its not then presumably its a macro alteration that's needed?? don't do it at this stage as depending on how it will be protected will mean that i need to make a few adjustments.
View 3 Replies
View Related
Aug 2, 2009
I've been reading about usage of worksheet functions in macros, and I guess I'm still not getting it. What I want to do, is use Countif and Indirect worksheet functions in a macro but it always fails. Here is my formula
IF(Worksheetfunction.Countif(Worksheetfunction.INDIRECT("[DaysWorking.xls]'Collect No Stats'!$A:$A"),'2009'!Range("D" & x))>0)
Basically, I want to see if 2 different cells in 2 different workbooks match and then I would use the information to write different info in another cell. X is just a variable in a DO WHILE LOOP. Can these functions be used in a macro? Is there an alternative?
View 3 Replies
View Related
Nov 3, 2011
It's simple enough to delete all macros. I have a form that starts as a landing area for a bunch of data then it gets renamed. I want to delete both of my command buttons from the sheet and remove all of my macros. How am I going to pull this off, how can i save it to the sheet the first time?
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'cut command buttons
ActiveSheet.Shapes("CommandButton1").Select
Selection.Cut
ActiveSheet.Shapes("CommandButton2").Select
Selection.Cut
[Code] .........
View 1 Replies
View Related