i created a spreadsheet which, using vba, disallows sheet deletion (works a dream); problem since has been that i cannot delete any sheets in any workbook anymore, and even a completely empty unsaved spreadsheet will try to open the worksheet containing the original code...
i've tried the following:
- deleted the workbook excel is trying to reference
- ensured there are no macros in excel
- ensured there is no vba code whatsoever
- checked the defined names (nothing)
- checked the vba objects
- debugged the "delete sheet" (didn't work)
- uninstalled all of office 2003, then cleaned registry, then reinstalled from scratch
- all of the above again
- searched about a zillion internet postings
I have a userform that has a lot of textboxes that are formatted as date fields. Some of them have a default value and are locked=true, enabled=false. For those ones I have a checkbox next to them so the user can unlock and enable the textbox if they so desired.
Well the checkboxes and textboxes have a similar naming scheme, but are not numeric (they are not CheckBox1, CheckBox2, etc). As an example they one grouping is Cust1RelExpUnlock (this is the checkbox) and Cust1RelExpDateBox (this is the textbox). The difference in their name is the last portion (Unlock or DateBox).
Now when the checkbox is selected the code I want looks something like this:
Code: Private Sub Cust1RelExpUnlock_Click()UnlockDateBox Cust1RelExpUnlockEnd Sub
Where UnlockDateBox is the function I'm having difficulty with and is supposed to be generic enough to work on any grouping assuming my naming scheme is consistent.
Using a combination of the Left() and Len() functions I can get the unique aspects of the name. Then concatenate it with "DateBox" as required. However I'm getting type mismatch errors, or object required erros. I tried various combinations of Dim _____ As Object, As Control, As Textbox... with no success.
I'm getting the correct name as a string, how do I make it work so I can reference the textbox.enabled/.locked?
Code: Private Sub UnlockDateBox(Ck) Dim CkDate As Control 'Tried control, textbox, object Set CkDate = ProjectInputForm.MultiPage1.Object ' tried just using ProjectInputForm, and Object Dim CkName As String
Is it possible to make a textbox or combobox the reference of a formula in a cell? I know that you can just do this on VBA, but if possible I don't want to do that in this particular case.
In a workbook made in Excel 2003, I have the following for a UserForm:
Private Sub UserForm_Activate Me.Calendar1.Value = Date End Sub
I copied this workbook to a computer with Excel 2007 and it bombs out at "Date" It comes up with a compile error, "Can't find project or library"
In the references window (Tools, References) it has the "Missing: Ref Edit Control" checked and the location at the bottom of this window states "C:Program FilesMicrosoft OfficeOffice11REFEDIT.DLL".
The reference to Office11 is from the computer with Office 2003 as the computer with Office 2007 has Office12.
There is another "Ref Edit Control" in the References window and when I check it and browse to the Office12 folder, highlight REFEDIT.Dll and click on open and in the references window on OK it comes up with "Name conflicts with existing module, project or object library". I have tried to delete the "Missing: Ref Edit Control", change the priority and change the reference in the missing control to Office12 but all to no avail.
How can I change the reference to the Ref Edit Control from Office11 to Office12?
I am trying to run the following macro to copy a data range(A1:HX1) range from one sheet(sheet 6) and past it into the next available blank row in another sheet called New_Overall_Input_File but get the following error when I try and run it......."Object Required"?
Sub ALLCARS() Sheet6.Range("A1:HX1").Copy New_Overall_Input_File.Range("D" & Rows.Count).Offset(1, 0).PasteSpecial xlPasteValues Application.CutCopyMode = False End Sub
I am trying to add a simple function to button in Excel.
First I need to select cell G24 as that where the inserted file should be placed on the worksheet. Then on the Add Object window to open but the tab 'Create from file selected.
Below is only part of the solution Sub ShowInsertObj() Application.Dialogs(xlDialogInsertObject).Show End Sub
Also is it possible to detect that file has been placed on the page ? In cell G24?
I am wanting users to attach a required zip file. I then need to check if they have done so.
I added this code to a userform initialize & now I get a message ' can't find object or library '. Which library do I have to activate in Tools, References.
Dim x As Integer ComboBox1.AddItem "0" For x = 1 To 20 Step 1 ComboBox1.AddItem Format(x, "0") Next x ComboBox1.Value = Sheet2.Range("E1").Value ComboBox2.AddItem "0" For x = 2 To 90 Step 2 ComboBox2.AddItem Format(x, "0") Next x ComboBox2.Value = Sheet2.Range("E2").Value
The word Format is highlited in userform initilize.
I need to identify the object that is triggering the current running macro. For example, i have 4 buttons say button 1 to 4 that all do almost the same thing. I have written 4 different macro for all 4 buttons but i want to simplify my code so that i can have a better leaner code by only using 1 macro for all 4 buttons. simply put is there a way to say identify which button/shape i pressed:
If "identity of button pressed" = "Button1" Then execute some code Else End If
My doubt it's at the final of the code when the condition If IE.Document.URL Like constantsValues.urlLoginData Then is true, it enter into a class an introduce the user and password from a login page AND then the page is REDIRECTED to another page SO when it goes out the IF CONDITION, the values that I had at the beginning in the IE Object are now DIFERENT because I'm now in a new page.
So that's why I put Application.Wait for 30 seconds, and then try to refresh the values of the IE object and get the new ones, but it always get the first values (the values of the login page :S) NO the new ones :S
How can I update the IE object to get the values of the actual page?
Code: Private Sub runMacro_Click() Dim constantsValues As CConstants Set constantsValues = New CConstants
I have been trying to create a macro in excel to chart a selection of data and to output the chart on the active sheet where the data was taken (as opposed to a named sheet). So basically, I have about 300 worksheets with data, and I would like to have a button on each page that automatically charts that data when clicked, and outputs the chart to the page where the macro was clicked. However, I have not been able to figure out a relative reference that will allow me to make the LocationasObject reference simply the ActiveSheet as opposed to a specifically named sheet. See my code below, which references an output to a worksheet called "Charts". Right now, all of my charts are outputting to the sheet called "Charts", as opposed to the active sheet.
Sub ConsDiscChart() ActiveCell.Offset(29, 11).Range("A1").Select Selection.End(xlToLeft).Select Selection.End(xlToLeft).Select Selection.End(xlToLeft).Select Selection.End(xlToLeft).Select Selection.End(xlToLeft).Select Selection.End(xlToLeft).Select Selection.End(xlUp).Select Selection.End(xlUp).Select Selection.End(xlUp).Select Selection.End(xlUp).Select Selection.End(xlUp).Select Selection.End(xlUp).Select Selection.End(xlDown).Select ActiveCell.Offset(0, 1).Range("A1:B1").Select Range(Selection, Selection.End(xlDown)).Select ActiveCell.Offset(0, -1).Range("A1:C24").Select Charts.Add ActiveChart.ChartType = xlLineMarkers ActiveChart.Location Where:=xlLocationAsObject, Name:="Charts" With ActiveChart .HasTitle = False .Axes(xlCategory, xlPrimary).HasTitle = False .Axes(xlValue, xlPrimary).HasTitle = False End With End Sub
I have written a macro that prompts the user to chose some files and if they meet certain criteria, it copies them to a specified folder.However, I have run into this 424 error "Object required".
Code: Sub FILES2SFTP() Dim FileNames As Variant Dim I As Integer Dim fso As Variant Dim Data As String ChDrive "G:" ChDir "G:TEST"
[code]....
The error is in this line:
If fso.getfilename(FileNames(I).Name) = ("Name1" & Data & ".xls" Or "Name2" & Data & ".xls") Then
I am writing a macro that will use information from the worksheet in use and the one prior to it. The problem is I do not know how to reference the worksheet that will always come before the worksheet in use. To fill you in, I have a monthly budget worksheet that tracks all my monthly financials. What I like to do is compare this months balances (cash, equity, bonds) and see the amount of loss/gain and percentage from the month before.
Here is what i currently have implemented.
This macro was written in the month of October. For this function the macro I wrote will take Octobers cash balance and subtract it from Septembers cash balance. This will give me the gain or loss. Now the problem is if I were to run this macro in November it will still reference September not October. I always want the macro to use the month before (the 1st tab to the left) not a specific tab. I wrote this macro using relative references so I do not understand why it will not use the tab before. Can someone please shed some light on this for me?
I'm fairly new to macro's and VBA, by searching on the internet i've copied and pasted some code together into a macro. But it ends in a Run-time error 91...
The macro opens a target .xls file in a selected folder, performs copy - paste actions from masterfile to targetfile. Than it filters data in the targetfile sheet1 and copy's the results to the various other sheets; saves and closes the targetfile. The next target file in the folder is opened and the actions are repeated in this second target file. For the first target file this works smoothly; but for the second one (of a total of around 100) it does not copy the filter results to the other sheets in this workbook. The error message i get is: "Run-time error 91:Object variable or with block variable not set." When i hit debug it highlights the line "ActiveSheet.Next.Select" which, at least in the first file, seems ok.
I'd like the "WildCard" to pull from a value in a cell whereby I can run a button macro that, when pushed, deletes the tab/worksheet named "WildCard". For instance, if I wanted to delete "Sheet3" I would type "Sheet3" into, say, cell C3 and then press the button to run the macro and "Sheet3" would be deleted. How to I refer the macro to cell C3? I currently have a macro that inserts/names a sheet based upon a cell reference and macro button. I'd like one that can delete in the same way.
I have recorded macros in the attached file to highlight cells that contain matching initials by using conditional formatting on the first cell and copying it to the remaining cells. The problem is that if rows are inserted above that change the first cell reference then the macro no longer works properly. Is there a way to use a relative cell reference within the macro? The macro buttons are in cells A4 to A13. I have no VB experience and created the macros by recording keystrokes and using tips found in this forum.
I get a lot of spreadsheets that I need to do an ascending sort on certain columns, but the problem is there is nothing to revert it back to its original sort. Is there a way to add a reference column numbered 1, 2, 3 etc. so i can return to the original order. The spreadsheets can be over 200 lines at times so doing it manually is really irritating.
It doesnt have to be too smart, just something to add a column and add the numbers say 1 - 1000 in ascending order, I can delete the excess as required. I know I could record a macro but that just seems to time consuming to go up to 1000.
I have a project that I'm going to attempt to handle, unfortunately I have no idea where to start. So any ideas or input to get me in the right direction would be greatly appreciated!! I am new to macro programming in excel and have a very light background in programming.
What I have:
Right now I have a data file(Sheet1) that lists the data of various accounts. Each row is a different account and each column is data that pertains to the account. Ex. Row 1 will be account # 1, with things like name, account number, address, etc... in columns A B C and so on.
What I want to do:
I need to make forms for EACH account in another sheet (sheet2), and in that form i need to reference specific data from Sheet1. THe reason it needs to be referenced is beecause if we make changes to Sheet1, the form will also need to be updated. Also, I dont need all the data in sheet one for each account, I will be pulling out data from different columns, ie. only columns A, E, F, etc...
Maybe it's not as complicated as i'm thinking, but i'm trying to figure out a formula (or macro) that will let me basically fill in a blank from a (nearly) irrelivant second worksheet. The only similarity the two will have is a PO number, or in my picture diagram, it's a letter. The worksheet that i'm trying to fill in the blank from has maybe 1500 entries, the worksheet i am referencing to has roughly 11,000, so sorting it would make no difference and the columns would be very inconsistant with eachother, but the rows will be similar.
I want to start a formula in Sheet one, that looks at the Letter in that same row, finds that Letter in Sheet two, and gets information from the same row but a few columns over. I might be explaining this poorly, so here's a picture of what i'm referring to. I'm trying to fill in F6 in Sheet 1 with information from F2 in Sheet 2.
I have a Workbook that has a macro that, as of now, is referencing the Workbook's file name. I'd like it to just be referencing the worksheet itself (it is in the same workbook) so that when the file name is changed, the macro still works.
I know which part needs to be changed... just not what to!
Code: Sub CopyData() Dim Cell As Range Dim DstWkb As Workbook Dim DstWks As Worksheet Dim R As Long Dim Rng As Range Dim RngEnd As Range Dim SrcCols() As Variant Dim SrcWks As Worksheet
I have checked the following reference whithin Excel VBA's references Manually:
Microsoft Visual Basic for Applications Extensibility 5.3
BUT when I run the following Macro, once checked the prior reference:
Sub AddModuleToProject() On Error Resume Next Debug.Print Err ' I GET 0 Dim VBProj As VBIDE.VBProject: Set VBProj = ActiveWorkbook.VBProject Debug.Print Err ' I GET 1004 Dim VBComp As VBIDE.VBComponent: Set VBComp = VBProj.VBComponents.Add(vbext_ct_StdModule) Debug.Print Err ' I GET 91 VBComp.Name = "NewModule" Debug.Print Err ' I GET 91 End Sub
I have created a workbook that generates new worksheets with unique identifiers as tab names. I.e. On a "Create New Sheet" worksheet, input three pieces of data, click "Create New Sheet" and this data is applied to a template sheet, macro continues running to copy the template and rename is with a unique SKU.
My problem is as follows: I have yet to figure out how to generate an Index page that is updated as each new sheet is added with the following:
a) Cell containing the SKU and a hyperlink (or some other link) to that particular tab, and b) Beside this cell, pull the contents of certain cells from that SKU's tab (such as description, but also the contents of calculated fields on that SKU's tab like current quantity and current price).
I would like the Index to be live so that if data is changed on the SKU's tab, it flows through to the Index......