I have written some code to search through excel sheets and return the values it finds. The code is written in a module, and when I run it by clicking the play button at the top of the VB editor it works perfectly.
However I have noticed that I need to link it to a button (on_Click) in sheet1, I have tried copying the code into the button sub, it throws up an error:
"Activate method of Range class failed"
Can anyone tell me why this code would work from its module and not when placed in the worksheet (the cells being activated are not empty).
I attached a sample of what I am working with basically at the end of the day I download all my sales and the following day my distributor sends me a sheet with all the orders that went out.
what I would like to do is match column A and C of the attached fileand have them match up on the same rowso then i can just deduct D from B and see how much I made off that particular item. im sure I have to put C & D in a diff sheet but I still do not know where to go from there
I know from the sample it would look like I could just sort but sometimes there is more in C than A or vice versa because of orders that were filled a day late or so.
I have created a spreadsheet that requires the buttons on a customised tab/ribbon in order to use it.
If this is on my machine where I have customised the ribbon it works fine. However I need to email this spreadsheet to another person - but wanted them also to have my customised ribbon. Is there anyway to do this - or would I have to go and customise their ribbon on their machine?
I'm trying to create an excel macro that can send emails with an attached file per row of my entry in excel I imagine it would be like the screenshot below. I've tried the code in the link below from a macro tutorial website but wasn't able to make it work due to error DataObject is unkown I'm using excel 2013 and lotus notes 8.5 as my email.
I've got an Excel worksheet that has 3 buttons on it. The worksheet may have some rows removed based on a parameter the user selects from a form. I've got the buttons placed where I would like them on the sheet, but if rows are deleted the buttons will move up depending on the number of rows deleted. I was wondering if there was any way to lock the placement of the button on the worksheet?
I want to disable the X button on the top right hand corner in excel, but still allow the user with the option of closing the workbook via File and then scrolling down to EXIT. (Not close). I have disabled most of the functions in the Menu bar Close being one of them.
So only Exit is now enabled. When I click on the X it give me the following message as shown below advising me to go to the File menu to Exit, this bit I am happy with. However this is were my problem begins, when I go to File and Exit I get the same message as below and can not exit the application.
Private Sub Workbook_BeforeClose(Cancel As Boolean) Cancel = True MsgBox "Please select EXIT from the File Menu.", vbCritical, "Cannot Close" End Sub
I'm having trouble to get VLOOKUP to work. Basically I need to look up Management Teir information from Sheet1 onto Main sheet as per the file attached. Both RecordID columns are Text so they should work right? But VLOOKUP returns #NA error.
The code below is supposed to disable the appropriate command buttons when it's associated cell values are 0.
Private Sub Worksheet_Activate() If Range("C17").Value = 0 Then ActiveSheet.CommandButton7.Enabled = False ActiveSheet.CommandButton4.Enabled = False Else ActiveSheet.CommandButton7.Enabled = True ActiveSheet.CommandButton4.Enabled = True End If
Not working ..... no buttons are disabled even with their cells are zero. Did I forget something?
I would like some help on disabling the Esc key in a macro and to disable the Cancel button and X on message and input boxes.
My macro is to insert rows in a protected worksheet and another to run a spellcheck, if my users hit any of the above keys during the macro my worksheet is left unprotected and formulas could be deleted in error. I have pasted a copy of my code below,
Sub InsertRowAboveCopyFormulas() ActiveSheet.Unprotect ("password") Dim Rng, n As Long, k As Long Application.ScreenUpdating = False Rng = InputBox("Enter number of rows required.") If Rng = "" Then Exit Sub On Error Resume Next ActiveCell.EntireRow.Select Selection.Resize(rowsize:=Rng).Rows(1).EntireRow. _ Resize(rowsize:=Rng).Insert Shift:=xlUp Selection.Offset(Rng).AutoFill Selection.Resize( _ rowsize:=Rng + 1), xlFill Selection.Resize(Rng).EntireRow. _ SpecialCells(xlConstants).ClearContents ActiveSheet.Protect ("password") End Sub
I'm sure there is a way to disable the 'X' (quit) button in the top right-hand corner of the EXcel application (not the 'X' for individual workbooks), or the hook the quit event so that I can run code that shut down the application cleanly? I'm sure a Windows API call is involved but do not know enough about that side of programming to know for sure.
I have buttons on each of my sheets, when one is clicked code is called in my module ("modAPI"), and from that code I wish to disable and enable certain buttons, and/or change the caption of those buttons. However when I try to do:
With ws btnRefresh.Enabled = False End With
I get Error 424, Object Required. I've tried recording a macro of what I wish to do, and it gives me ActiveSheet.Shapes("btnRefresh").Select, but this doesn't give me the option to enabled/disable or change the caption of the button.
I have two option buttons on a user form, one for a temperature of <250 & one for a temperature >250. I want the option button >250 to be greyed out or have it so that you cannot choose it & option button <250 selected if a certain criteria in a list box is selected. The list box is called Valve_Model & the criteria i want it to work on is if the valve model HPBV Soft is selected & HPBV Soft AC.
I'm using the following code to create an Inputbox but I want to either disable the OK button until an entry is made or not allow a blank entry. Forcing the user to have to make an entry.
If NameTextBoxnew.Value = "" Then NameTextBoxnew.Value = Application.InputBox("You must input a name/nickname to identify person", "Name") End If If SexTextBoxnew.Value = "" Then SexTextBoxnew.Value = Application.InputBox("You must select a sex(m/f)", "Sex") End If If DOBTextBoxnew.Value = "" And AgeTextBoxnew.Value = "" Then AgeTextBoxnew.Value = Application.InputBox("Please insert a rough age in years", " Date of RSIT") End If
I have a userform with a textbox and a command button. I have used data validations on the textbox. Clicking the command button saves the data in the worksheet. It works well if the user hits tab, enter or down arrow key after entering the data. The problem is, the textbox validations fail to get executed if the focus stays on the textbox and command button is pressed. I want the command button to be disabled until the user has moved the focus away from the textbox -there by executing the validations!
I have the following question: I attached my file. In sheet "boekhouding" I want every cell in column H to contain a button that locks that specific row. So I can't accidently change the dropdownmenu for that row.
I also have some sort of strange problem in worksheet "Rekeningen", Range D1-D5 is named "Grootboek" were it should be named uitgaven. I can't change the name, but it doesn't seem to matter in worksheet rekeningen (the drop down menu for uitgaven works normally), what is wrong here?