Go To Sheet Named As Text In Button Caption

Jun 3, 2008

There is a 'Home' page with a button for each employee - clicking the button takes the user to the appropriate employee's timesheet

There is also an 'Add New Employee' button on the home page which brings up a form and allows a new employee to be added.

Each employee has only 1 worksheet (Which is created based on a blank template page)

When the 'Add New Employee' button is clicked a form pops up which ask for name, D.O.B etc. The user fills out the form and clicks ok. The template sheet is then copied, renamed to the employees name, and all relevent fields are added to the template sheet (based on the users input). A button is also generated on the home page with the employees name as a caption and when it is clicked it goes to employees timesheet.

I have almost got this working.

The only problem is this only works once, So For Example say i Add 'John' then i add 'Mary' on the home page i now have 2 buttons with 'John' and 'Mary' on them. The problem is as soon as a second employee is added (Mary), the first employees button(John) is linked to the second employee's Sheet rather than its own(Mary). and after the spreadsheet is closed the buttons dont work at all.

The link below has the spreadsheet i have made so far, you can test it out if my description doesnt make sense or you can see the code behind the 'add new employee' form:

############################################################
#### 'Add Employee' Button on Add New Employee Form ####
############################################################


Private Sub cmdadd_Click()


'check for Name
If Trim(Me.EmpName.Value) = "" Then ..............................

View 9 Replies


ADVERTISEMENT

Link Cell Text To A Command Button Caption

Sep 4, 2006

I have created a cover sheet with various command buttons linking into the available worksheets. I was wondering if it is possible to set the title of the command buttons by linking them to the text in a particular cell in each work sheet??

View 3 Replies View Related

Label Controls Whose Caption Is Set From Text From A Work Sheet

Nov 23, 2007

I have a label control whose caption is set from text from a work sheet
How can I set the text of the caption to bold

View 9 Replies View Related

Add Button Caption To Cell

Jan 9, 2007

Is there a way to program a VBA button so that its cell location is known. For ex., I have a button that says "Fail". I'd like to program it in such a way that when the user clicks on it, the text "Fail" is inserted into the cell next to it. How do I avoid hard-coding the cell reference?

View 5 Replies View Related

Toggle Button Caption Between On/Off

Jan 24, 2008

I need a macro for button1. The name of button one is "on" when clicked I want it to put an "X" in A1 and then change the button name to "off" When clicked again I want it to delete the "X" in A1 and change the name back to "on". When clicked again it repeats the same process.

View 7 Replies View Related

Form Button Caption Not Showing

Aug 31, 2007

I have used the Forms toolbar to create a command button on a chart.

However, the text for the command button is hidden. If I do an "Edit Text" on the button, it shows up, but otherwise the button appears blank, even when selected.

View 9 Replies View Related

Change Button Shape Caption

Feb 14, 2008

How do you references the properties of a shape? I am having trouble with 2 different types. Firstly, I have a worksheet with a group of commandbuttons (all added using the Control toolbox) and I want to loop through them changing, for example, the enabled property of each to TRUE.

Secondly, I have some commandbuttons on a worksheet (added using the Forms toolbox). How would I loop through changing, say, the text on the buttons. I used the macro recorder to try to get an idea and got the following:

Sheet1.Shapes("button 15").Select
Selection.Characters.Text = "New Text"

Although this works, it is not very elegant, how can it be achieved without selecting the button each time, but rather by directly accessing the property.

View 3 Replies View Related

Alternate Button Macro & Caption Between 2

Apr 23, 2008

I have a worksheet with 2 buttons labelled "Hide" and "Show". As the names imply, they allow the user to hide or show parts of the worksheet. I would like to combine them into one button and have the button label and the associated macro change with each press of the button. Here is what I have so far;

Sub SHOW_LEADS()
Rows("10:15").Select
Selection.EntireRow.Hidden = False
ActiveSheet.Shapes("Button 20").Select
Selection.Characters.Text = "HIDE LEADS"
Range("A1").Select 'is there a better way to remove the focus from the button than selecting a cell off the button?
End Sub

Sub HIDE_LEADS()
Rows("10:14").Select
Selection.EntireRow.Hidden = True
ActiveSheet.Shapes("Button 20").Select
Selection.Characters.Text = "SHOW LEADS"
Range("A1").Select
End Sub

These macros change the label fine after hiding or unhding the rows but I can't find the proper terms to use to change the macro associated with the button (if there is one?)

View 4 Replies View Related

Toggle Column Visiblity & Button Caption

Nov 15, 2006

On creating a button to perform a macro, we are hiding columns.

Can the macro pick up that

If the columns E:J are hidden, then the text on the button to read 'Unhide'
If the columns E:J and unhidden, then text on the button to read 'Hide'

I am aware I can change what is written on the button via a macro, but can it see that the columns are hidden?

View 9 Replies View Related

Change Caption Property Of Option Button

Mar 23, 2007

I have a problem with the changing the caption property of the option buttons to bold, italic and regular.

Is it some vb code you need to put in for the option buttons?

View 8 Replies View Related

Change Output Of Option Button To Caption Or Name

Jan 11, 2008

I'm a complete Excel and VBA newbie and would like to know if it's possible to change the output of OptionButtons from 'TRUE' or 'FALSE' to "1"/"2"/"3"/etc..

The name of each button is:

Rating 1
Rating 2
Rating 3
Rating 4
and so forth..


The idea is for each rating to output its assigned number such that if the user were to click "Rating 1", the result would be "1", "Rating 2" = 2 and so on. I'm trying to design a survey and these results will then be used to calculate an average rating. If this is possible, how would I need to write the code for it?

View 2 Replies View Related

Change Toggle Button Caption On 2007 Ribbon

Jul 1, 2008

I currently upgrading some add-in to Excel 2007. This one concern a toolbar or Ribbon as they call it now. I am creating a toggle button using XML

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="rxTrading" label=" Trading" >
<group id="rxDownloadStockData" label="Download Stock Data" >
<button id="rxDownloadData" label="Download" onAction="rxDataStock_Download" />
<toggleButton id="rxEnableDisableDowwnload" label="Enable Download" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

How can I change the name of toggle button to "Disbale Download" after clicking on the toggle button? I am trying to find the answer on WROX Excel 200 VBA but I am lost.

View 2 Replies View Related

Conditionally Show/Hide Columns & Change Button Caption

Jan 22, 2009

After scouring the entire OzGrid, I have found the following two macros that partly satisfy what I want to achieve. BTW, following two macros are executed on Sheet2 and I want to achieve the following:
On Worksheet_Activate, show columns that match the criteria value in Sheet1.D4 (Sheet1.D4 contains a dropdown list with about 6 text values). In addition to that, if Sheet1.D4 value is blank then show all columns. Right now, it successfully shows columns that match the D4 value but does not work if that D4 value is left blank, instead it hides all columns in range (C:CV). So in short, to the first macro, I need to add the criteria if D4 is blank, then keep the sheet intact and don’t hide anything, just show all columns.Once on that sheet after the Worksheet_Activate event has occurred, with the second macro “ToggleColumnsVisibility” following things need to happen. BTW, currently this macro is assigned to a button (from Forms Toolbar).If cell D4 has a value, then the button’s caption should read “Show All” and when that button is pressed, it should show all columns in the range (C:CV), and the button's caption needs to change to “Show Selected”. In “Show Selected” mode, when that button is pressed, it needs to show all the columns that match the D4 value.If cell D4 is left blank, then the button's caption should read "No Action" and when the button is pressed, it should not do anything but just show all columns.

As you will notice in the header, my experience with Excel is very limited, so detailed instructions will be greatly appreciated. I am also hoping that proposed solution uses some of the efficient/effective ways of using loops such as described below (example taken from this website from this link http://www.ozgrid.com/VBA/SpeedingUpVBACode.htm)


Sub TrueOrFalseFaster()
Dim bYesNo As Boolean
Dim i As Integer
bYesNo = (i = 5)
MsgBox bYesNo
End Sub

Sub ToggleTrueOrFalseFaster()
Dim bYesNo As Boolean
bYesNo = Not bYesNo
MsgBox bYesNo
End Sub .........

View 9 Replies View Related

Hide Button Or Textbox Based On Caption Across Multiple Sheets

Oct 16, 2009

I have a workbook with 31 sheets. Each sheet has 15 textbox button that call macros.
I would like to hide 1 textbox on all sheets until another macro is called. I know how to get the textbox names to be able to hide them, But because these text boxes were copied most of the are the same name, however on severl sheets they are different names "Textbox 4 on most sheets but it could be textbox 34 on others. The ones I want to hide all have the same text label. Is it possible to get VBA to return the label text.

View 8 Replies View Related

CommandButton Caption Text Clipped

Oct 14, 2009

I have a commandbutton who's caption text is getting clipped along the bottom when I view the sheet at 100% zoom. If I look at 200%, the text is fine. What's going on here? I've included a pic of the offending button. Note the missing bottom part of the "g".

View 2 Replies View Related

Activate Sheet Of Checked OptionButton By Caption

Jan 14, 2008

I have created a Group Box in Excel with 4 Option Buttons in the group. I have also created a Command Button which currently, when clicked, changes to a worksheet I specified. I am trying to have the Comand Button, when clicked, look at the selected Option Buttons in the Group Box and change to the worksheet specified by the selected Option Button. I have tried an IF..THEN statement with no success. code below that I have tried.

Private Sub CommandButton1_Click()
If AM40 = 1 Then
Sheets("Billboards(1)").Select
'ElseIf AM40 = 2 Then
' Sheets("Live Events Feedback(1)").Select
End If
End Sub

View 3 Replies View Related

Show Text In Active Window Caption

Aug 21, 2006

In an open excel file, in the top left-hand corner, the file name is always "Microsoft Excel - Your File Name".

does anyone know how to have the top-left hand corner show "Your File Name" only?

View 9 Replies View Related

Dynamic Sheet Level Form Button Text

Jun 19, 2007

I have a form button on a worksheet which calls a specified macro, is it possible to have the text which shows on the button, dynamic? I have created a template excel file, which the user needs to set up as they see fit. I have a separate page which is an 'admin' page where they can customize the narrative in the main template, which includes being able to change the text on form buttons on sheet 1. I have tried with this: Sheets("Approvals").Object("Button 1").Text = Sheets("Admin").Range("e14").value

This unfortuantely results in a "run time error '438' Object doesn't support this property or method". From that i would assume this function is not available, but i'm hoping someone may know a way around it??

View 5 Replies View Related

Selecting Named Range Before Printing Using Print Button?

Oct 17, 2013

I have been trying to see if I can set up a single (A1) print button to create a selection box to select a name range and than print that range, but have been unable to figure out how to accomplish it. I have 26 name ranges called PP01 thru PP26 and I want to be able to select the range before printing.

View 1 Replies View Related

Command Button - Create A Save Button In Sheet 1?

Mar 9, 2013

i want to create a save button in sheet 1, on clicking the same the data entered in the particluar cells of sheet 1 should get saved in sheet 2 in given format

View 1 Replies View Related

Unhide Sheet Based On Named Range In That Sheet

May 6, 2012

Is there any way (in vba code) to unhide the sheet of a given named range?

If would come before the following line of code whee CurReference is already defined

Application.Goto Reference:=CurReference

View 1 Replies View Related

How To Change Named Sheet To Active Sheet (VBA)

Jul 19, 2012

How do i change the below code to not reference a named sheet but the active sheet.

In case you need it i'm trying to sort columns A:CQ on row 2 smallest to largest from left to right.

Code:
Sub Sort_Left_Right()
' Sort_Left_Right Macro
Columns("A:CQ").Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("A2:CQ2") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal

[Code ..........

View 3 Replies View Related

Excel 2010 :: How To Assign Macro From One Sheet To Form Button On Different Sheet

Mar 6, 2014

I am running excel 2010 with windows 7. I created a macro in sheet 1 and I wish to activate the macro from sheet 2 using a form button. I have entered the code below. I know how to perform this function on a more simple macro like adding names to cells. This code is a bit more complex I just dont know where to start.

Code:
Sub LoanData()
'
' LoanData Macro

[Code].....

View 3 Replies View Related

Command Button To Copy Cells From One Sheet And Paste In Second Sheet

Aug 21, 2014

I'm trying to create a command button on my sheet that when clicked will find all rows in column u that read Engineering Evaluation and then copy certain cells from that row to another sheet. The kicker is that this button will be used over and over again as more entries are entered into the log. I only want each row counted once.

Right now I get a run time error for the "For Each Cell In Application.Intersect(Range("u:u"), target)" line.

View 6 Replies View Related

Swap Out Text In Text Box Based On Radio Button Selection

Dec 12, 2012

If the user selects French (radio button selection), I want to swap out the existing English text for French and vice versa. One large text box with several paragraphs. Can Excel do this?

View 2 Replies View Related

Option Button On Sheet 1 To Change Image On Sheet 2

Jan 15, 2007

Sub OptionButton222_Click()
With Worksheets("Beam Input")
.Shapes("Notch 1").Visible = False
.Shapes("Notch 2").Visible = False
End With
End Sub
Sub OptionButton223_Click()
With Worksheets("Beam Input")
.Shapes("Notch 1").Visible = False
.Shapes("Notch 2").Visible = True
End With
End Sub
Sub OptionButton224_Click()
With Worksheets("Beam Input")
.Shapes("Notch 1").Visible = True
.Shapes("Notch 2").Visible = False
End With
End Sub

i need to modify it so that a selection on the beam input page causes the images to change on the beam output page. Currently this code is in the module section of VBA.

View 2 Replies View Related

Disable Userform Command Button Unless Text Box Contains Text

Jan 20, 2014

I have a userform and want to disable the command button unless a text box contains text. what I need to do?

View 2 Replies View Related

Using Named Range On Different Sheet?

Nov 17, 2013

I am trying to use a named range on a different sheet in the same workbook to which the named range is on.

I have a named range on sheet2 called "Letters" and comprises of cells D20-D25 .

I am trying to call this range on Sheet1 at A1-A6 , so in A1 to A6 I simply have "=Letters" (No quote marks) , but I simply get "#VALUE!" (No Quote Marks), If I then extend the selected cell down to A25 the "Letters" will appear in A20-A25
whereas if I put the same "=Letters" in Sheet1 cell A20-A25 I will get the correct named range.

How can I get the range to show in Sheet 1 Cell A1-A6.

I want to reproduce a named range at a different location on a different sheet in the same workbook.

View 2 Replies View Related

Sheet Named From Cell

Nov 25, 2006

Sub AddSheet()
Dim strName As String
Dim oSHeet As Object
Dim intNumSheets As Integer
strName = Range("A1")
On Error Resume Next
If Sheets(strName) Is Nothing Then
Sheets.Add().Name = strName
If Sheets(strName) Is Nothing Then Goto NonValidName

Else
MsgBox "Sheet: " & strName & " already exists"
End If
On Error Goto 0.....................

However once the code has run it then deletes the content of A1, is there a way to stop it doing this as I would like the name left there.

View 2 Replies View Related

Put Text Into Named Range

Oct 4, 2007

I have a tiny problem with a bug in excel. You see, if you try to enter an empty range into a line graph you will error out. Well, I can't guarentee that the range will have at least one value in the macro so I was thinking that I would initalize a range varable (say ProductXRange) to an error message that reads: "ERROR: Selected Product Data is Not Available." Thus by guarenteeing me an entry no matter what. The question I have is because the string is not on a worksheet, how do I force it into the range varable (ProductXRange)? I.E. ProductXRange would in reality have one entry...the error massage.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved