Set Variable To Forms Control & Get Value Property
How do I reference a spin button from a variable that I set.
e.g
Dim objSpn As Object
Dim y As Integer
Set objSpn = ActiveSheet.Shapes("spnWCDate")
y = objSpn.Value
This doesn't work, but hope it explains what I want. It's so I dont have to write the whole object name each time I reference it.
ADDED: I've just noticed that this doesn't work even i do reference the object with the full name. I copied this from a forms spin control that I was using, why can't i store the value of the spin button in a variable?
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
Set Control Visibility Based On Tag Property
I have a userform which uses the tag property of the frame to determine whether a frame is visible (and hence the controls that reside within the frame). A frame contains three combo boxes, and six text boxes. The tag property of the frame matches the number of frames that are visible on the form, so that if the user selects five frames, frames 1 through five become visible and for all other frames visible = false. A frame contains all the data for a single entry. There can be up to fifty frames/ entries that are visible on the form depending on the user selection. I want to use the visibility property to do two things: first the combo boxes are filled from an array after the user selects the number of frames (or entries). I only want to fill the comboboxes where the frame is visible. The second thing is that I have a function which uses the data from the text boxes and combo boxes as required arguments. Since these are required arguments, I will get a data mismatch error if I try to call it and the controls are empty. Therefore, I only want to call the function if the frame which houses the controls is visible. Public Sub Visible1(Entry As String) Dim ctrl As Control For Each ctrl In UserForm2.Controls If TypeName(ctrl) = "Frame" And ctrl.Tag <= Entry Then With ctrl .Visible = True End With Else If TypeName(ctrl) = "Frame" And ctrl.Tag > Entry Then With ctrl .Visible = False.............
View Replies!
View Related
Set Range Variable To RefEdit Control
I'm trying to set up a userform with a refEdit box that allows the user to select a cell range. I then need to assign that cell range to a range variable so the macro can use it. I'm having a problem reconciling the assigned string variable that refEdit returns and the range variable that I need. So what I'm trying to say is that I can assign the range fine through the Userform, and I can see through the debugging screen that mySampleVariable (dim as a variant) holds a range value of 'Access Dump'!$A$8 (the correct range), but when I try to Dim myRange As Range Set myRange = mySampleVariable The code bugs out because it apparently can't assign a string value to a range variable.
View Replies!
View Related
Value From Forms Combo Box Control
I have a (form control) combo box in my worksheet. Inside the combo box are several different ways a data set might be sorted. I would like to refer to the current selection of the combo box in my VBA code because I have a macro which executes differently based on the selection in the combo box. I have found this piece of code which I know executes when the combo box selection is changed. Sub DropDown1_Change() However, I still do not know how to refer to the value of the current selection. Below was my attempt to assign the current selection to a name, ComboValue, that I created: Sub DropDown1_Change() Names("ComboValue").value = ComboBox1 End Sub Strangely, this code executes once, but removes the name I created. It then returns an error on subsequent runs.
View Replies!
View Related
Clear Forms Control ComboBox
I have a combobox from the Forms Toolbox inserted in a worksheet and have a macro assigned to run when the user selects a value. After the value is selected in the combobox I'd like the combobox to clear itself (show a blank). Currently the selected value stays highlighted in the combobox after the selection is made. I know how to do this with a Controls combobox, but cannot figure out how to use it with a Forms combobox. (The reason I am not using the controls cb is because there seems to be an Excel2007 bug that causes the properties of the displayed text to randomly change when the control is activated. When a selection is made in the controls cb, the text displayed in the cb turns bold, and either grows or shrinks in size to the point that it is unreadable. Same thing seems to happen with all other ActiveX controls...) Sample attached.
View Replies!
View Related
Fill Forms Control ListBox
I created a list box from Forms toolbar (instead from VBE). I would like to add items to this list box using VBA, but cannot find right qualifier to access this object. When I tried to use " recording macro," the code that was generated was ActiveSheet.Shapes("List Box 7") but if I try something like ActiveSheet.Shapes("List Box 7").addItem "hello" it doesn't work, because well, addItem method belongs to ListBox object, not to Shape. So if I want to add an item to this list box, how should I reference this list box so that I can call addItem() on it?
View Replies!
View Related
Transfer Control Values Between User Forms
I am using a calendar control 11 in a user form. I would like to create a combobox on a user form that when you click the drop down button it opens the calender then the user can select a date which is then returned to the combobox. I beleive the way to do this is to trap the dropbuttonclick event. Tho it dosent seem to work. Private Sub ComboBox2_DropButtonClick() Calender.Show ComboBox2.Value = Calender.Calendar1.Value End Sub
View Replies!
View Related
Set Variable: Object Variable Or With Block Variable Not Set
I have the following code (just pasting the relevant section) which crashes when it reaches the highlighted line of code. and a dialog box pops up with the text: "Object variable or With block variable not set" Sub test() Dim StartRng As Range Dim Buffer As Range Set StartRng = WorkSheets("Sheet1"),Cells(1,1) StartRng.Activate ActiveCell. CurrentRegion.Select Buffer = rngStart.CurrentRegion.Copy ' I also tried the following line of code but that didn't work either 'Set Buffer = rngStart.CurrentRegion.Copy .. ... End Sub
View Replies!
View Related
Evaluate UserForm Control Where Name Is In 1 Cell & Property In Another
In A1, other code inserts the name of a Form control (textBox, comboBox etc), and in B1 it inserts the name of a Property that is always valid for the A1 control. I want to concatenate these two items to produce a formula in C1 that evaluates the current value of the Property on the running form and continues to update with each recalc. It's ok if I have to force a recalc to get the latest values. The code feeding the items to A1 and B1 and which will be harvesting the Property values from C1 is running in the same Form that holds the controls being referenced. So if A1= "Label1" and B1 = "BackColor", then in C1 I'd like the same result as if in VBA I said X = Label1.backcolor. I think that what I need is the Evaluate function, but I've read Arron's article on it I just can't seem to make it work here.
View Replies!
View Related
Cannot Set Listindex Property!
For some reason my selection won't return to where it's supposed to in a listbox after I've increased it's column widths. It's very strange. I've put together an example of the issue as the actual workbook is enormous, but the demonstration seems to work. I've tried exporting the Listindex resetting code to an external function, but it didn't help either. Can anyone understand this behaviour?
View Replies!
View Related
Unable To Set Formula Property Of Series
I went through a lot of threads in this forum, although there were a couple relating to the same problem am facing, they didnt solve my error .. so here's my question again .. When am trying to delink charts , i get an error stating "Unable to set the formula property of series class". The code is as follows : Sub DelinkChartData() Dim iCtr As Integer, iChars As Integer, SH As Shape, iPlotOrder As Integer Dim nPts As Long, iPts As Long 'Holds the total no of points in the chart Dim xArray, yArray, sChtName As String, sSrsName As String Dim xVals, yVals Dim ChtSeries As Series ' var used to loop thru the series collection Dim ws As Worksheet Dim sChartType As String, iCtr1 As Integer
View Replies!
View Related
Unable To Set The Orientation Property Of The PivotField
I want the data field to change to a different field when a command button (cmd_view) is clicked. So when the command button has a caption of "Toggle to Feeds", the code changes the field from Sqm to Feeds, and changes the caprion on the command button to "Toggle to Sqm". When this is next clicked, the fields are swithed over, and the command button caption changes relative to it. The code I have written is below: The problem I have is when the code changes the view from feeds to Sqm, it works fine, but when the code changes from Sqm to feeds, it crashes out in the true part of the If statement on the code line ".orientation = xlhidden" with the error "Unable to set the Orientation property of the PivotField class". As the code for the change of view is the same, apart from the field names, I am at a loss on what is the cause. I have tried to record a macro to see if the field names appear differently, but they do not. Sub Tog_pivot() Dim Toggle As String Application.ScreenUpdating = False Toggle = Sheet5.cmd_View.Caption If Toggle = "Toggle to Feeds" Then 'switch view from Sqm to Feeds Range("F12").Select ' hide existing field With ActiveSheet.PivotTables("Pivot_forecast_old").PivotFields("Sum of Sqm") .Orientation = xlHidden End With ' Create & display new field "Feeds"......................
View Replies!
View Related
Unable To Set The Xvalues Property Of The Series Class
For the last day I have been getting the following error: "Run-time error '1004': Unable to set the Xvalues property of the series class." The archetecture of the marco is sound being that I have used this methology in another macro and it works correctly every time. The XValuesand Values range are also correct and I know this because I had the macro select the data cells and it does this correctly as well. The data for simplicity at the moment has no empty cells or abnormal data. The data cells are all filled with some kind of data. For the XValue Range the data would look something like "2070087 4/27/2007" and the Values range is filled with a number between 0 and 100. What I can't figure out is why it crashes with a valid establish range. I highlighted the lines it crashes on in read, they are near the bottom. Sub Proto1() ' ' Proto1 Macro ' Macro recorded 8/30/2007 by aaron.verellen ' ' Dim CurrentSheet As String, ChartName As String Dim RowCount As Integer, ColumnCount As Integer, FirstColumn As Integer, LastColumn, _ FirstRow As Integer, LastRow As Integer, Row As Integer, Column As Integer, _ ProductColumn As Integer, ArrayIndex As Integer, ParameterCount As Integer, _ ItemCount As Integer, MyIndex As Integer Dim UserProductFlag As Boolean, NewProductFlag As Boolean Dim Possibilities() As String Dim ProductXRange As Range, ProductYRange As Range .................
View Replies!
View Related
Unable To Set The Visible Property Of The Worksheet Class
I've been using the following code successfully for years. Today I would get the error 1004:Unable to set the visible property of the worksheet class. All my searches came up with someone not realizing they had protected the workbook. As you can see, the first thing I do before trying to set the worksheet visible is to unprotect the workbook. In frustration and on a lark I tried .Sheets("items").Visible = True and it worked. These kind of intermittent errors in Excel VBA are very frustrating. Can anyone tell me what I am doing wrong?
View Replies!
View Related
Unable To Set The Formula Property Of The Series Class
I am struggling with one problem. I am trying to change formulae of series in a chart using VBA code given below. But I am getting 'Runtime Error 1004, Unable to set the formula property of the series class' ActiveChart.SeriesCollection(1).Formula = _ Replace(ActiveChart.SeriesCollection(1).Formula, "Sheet1", "test")
View Replies!
View Related
Unable To Set The Locked Property Of The Range Class
I am using the below code to unloock certain columns based upon a value in cell a1. The value is the previosu month end date. It was working, but now I am getting " run-time error 1004 Unable to set the locked property of the range class" Can anyone help me to fix the error. Sub UnlockMe() Dim cl As Range ActiveSheet. Unprotect "password" For Each cl In Range("$B$1:$M$1") If cl = [a1] Then cl.EntireColumn.Locked = False cl.EntireColumn.Interior.ColorIndex = 6 Else cl.EntireColumn.Locked = True cl.EntireColumn.Interior.ColorIndex = xlNone End If Next cl ActiveSheet.Protect "password" End Sub
View Replies!
View Related
Macro Error Message (object Variable Or With Block Variable Not Set)
When i try to run the code below i get the error message - object variable or with block variable not set- Sub REFRESHXX() 'LIST Cells(Sheets("POINTS").Range("DD801").Value, Sheets("POINTS").Range("DD800").Value).Select Selection.AutoFilter Field:=1, Criteria1:="1" 'SET RANGE Dim sFormula1 As String Dim sFormula2 As String Dim sCell1 As String Dim sCell2 As String Dim sSheet1 As String Dim sSheet2 As String Dim r As Range Dim MyRange As Range 'for testing With Sheets("Points") sFormula1 = .Range("CY1").Formula sFormula2 = .Range("CY2").Formula End With 'FORMULA IN R1C1 STYLE strFormula = "=IF(ISNA(VLOOKUP(RC[-1],MASTER!R4C3:R17908C7,3,FALSE)),0,VLOOKUP(RC[-1],MASTER!R4C3:R17908C7,3,FALSE))" 'ENTER FORMULA IN ALL CELL RANGES r.FormulaR1C1 = strFormula 'REDUCE TO VALUES Dim ar As Range 'an area is a range For Each ar In r.Areas 'areas are discrete, contiguous ranges of cells ar.Value = ar.Value Next ar 'UNLIST Cells(Sheets("POINTS").Range("DD801").Value, Sheets("POINTS").Range("DD800").Value).Select Selection.AutoFilter Field:=1 End Sub
View Replies!
View Related
Find Dates Macro: Object Variable With Block Variable Not Set
I found this nice little bit of code for a date range search in column A but it will not work. Apparently i have not set a variable or something. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim startDate As String Dim stopDate As String Dim startRow As Integer Dim stopRow As Integer startDate = InputBox("Enter the Start Date: (dd/mm/yyyy)") If startDate = "" Then End stopDate = InputBox("Enter the Stop Date: (dd/mm/yyyy)") If stopDate = "" Then End startDate = Format(startDate, "dd/mm/yyyy") stopDate = Format(stopDate, "dd/mm/yyyy") startRow = Worksheets("sheet1").Columns("A").Find(startDate, _ LookIn:=xlValues, lookat:=xlWhole).Row stopRow = Worksheets("sheet1").Columns("A").Find(stopDate, _ LookIn:=xlValues, lookat:=xlWhole).Row Worksheets("Sheet1").Range("A" & startRow & ":A" & stopRow).Select End Sub
View Replies!
View Related
Run Time Error 91 Object Variable Or With Block Variable Not Set
I am having a lot of trouble finding out why I am getting error. I believe the error is because it can't find the number. In cells C115:C314 i have the numbers 1 to 200 in order. when someone types in 1 to 9 in the text box it works, but on 10 and over i get the error ???? here is the code I have shCalculator.Range("C115:C314").Select Selection.Find(what:=CInt(txtPackageID), After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Select x = ActiveCell.Row shCalculator.Range("ProposedMeter").Value = Cells(x, 7).Value shCalculator.Range("Package").Value = Cells(x, 12).Value shCalculator.Range("ProposedMeterAmount").Value = Cells(x, 30).Value shCalculator.Range("Term").Value = Cells(x, 62).Value shCalculator.Range("Discount").Value = Cells(x, 67).Value shCalculator.Range("Equipment").Value = Cells(x, 72).Value
View Replies!
View Related
Find Method Code: Object Variable Or With Block Variable Not Set
I need my program to: - find the cell containing the string "Datum/Tid" - record the column and the row of the found cell in two variables lCol and lRow Here is my Sub test() Dim rFoundCell As Range Dim lRow As Long Dim lCol As Long 'Find method of VBA Set rFoundCell = Range("A1") Set rFoundCell = Worksheets("Sheet1").Range("A1:Z50").Find(What:="Datum/Tid", After:=rFoundCell, _ LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False) 'for anyof the two lines down I get the message "object variable OR block variable not set" lRow = rFoundCell.Row lCol = rFoundCell.Column End Sub
View Replies!
View Related
Run Time Error 91, Object Variable Or With Block Variable Not Set
Function Find_Range(Find_Item As Variant, _ Search_Range As Range, _ Optional LookIn As Variant, _ Optional LookAt As Variant, _ Optional MatchCase As Boolean) As Range Dim c As Range If IsMissing(LookIn) Then LookIn = xlValues 'xlFormulas If IsMissing(LookAt) Then LookAt = xlPart 'xlWhole If IsMissing(MatchCase) Then MatchCase = False With Search_Range Set c = .Find( _ What:=Find_Item, _ LookIn:=LookIn, _ LookAt:=LookAt, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=MatchCase, _ ........................ Using the message box I see that sheet 1 opens but then I receive an error message Run Time Error 91, Object Variable or With Block Variable not set. I tried declaring and using set on "project" but got nowhere. I also need to have a message indicating project not found. Once this part is solved I will loop all of my other workbooks
View Replies!
View Related
2007 Macro: Run-time Error 91:Object Variable Or With Block Variable Not Set
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.
View Replies!
View Related
Runtime Error 91, Object Variable Or With Block Variable Not Set
This works fine in Excel 07 but when ran in 03 it doesn't work and I get that error message. Sub mcrRefresh2() Sheets("WeeklyData").Range("A1").ListObject.QueryTable.Refresh BackgroundQuery:=False Sheets("WeeklyData").Range("aa1").ListObject.QueryTable.Refresh BackgroundQuery:=False Worksheets("WeeklyPivot").PivotTables("PivotTable1").PivotCache.Refresh End Sub
View Replies!
View Related
Debugging Error: Object Variable Blocked Variable Not Set
I am getting an error at this line: Set rng5 = Range(.Cells(celle2.Row, celle4.Column), .Cells(celle2.Row, celle4.Column)) Sub UpdateNumbers() Dim rng1 As Range Dim rng2 As Range Dim rng3 As Range Dim rng4 As Range Dim celle1 As Range Dim celle2 As Range Dim celle3 As Range Dim celle4 As Range Dim celle5 As Range Dim flag1 As Long Dim flag2 As Long................
View Replies!
View Related
Object Variable Or With Block Variable Not Set Error With Macro
I attempted to modify "macro_1a1ay" to look into the "comments" sheet (column a) for a specific text string. If that text string is found, I have it delete the entire row, then re-sort the page and return to the calling page. It works well as long as it finds something. When it does not find the string (i.e. like now when the page is blank) it gives me the run-time error mentioned above.
View Replies!
View Related
Find Method: Object Variable Or With Block Variable Not Set
I have a spreadsheet form with all kind of values and what I want to do is to find a data in a worksheet named "Config" based on the spreadsheet activecell value. With the find row adress I return data of another column but same row (in the worksheet) in two diferent label captions. If the spreadsheet activecell value it was found in the worksheet everything is ok but if the value is not found I'm getting the message "Object variable or with block variable not set"....
View Replies!
View Related
Error: Object Variable Or With Block Variable Not Set
I've set up a userform (frmCoC) to read and write info to the "contractor database". Within that userform is a listview control that reads off a second, "induction database". When the user selects and clicks on one of the displayed entry in listview, another form (frmInd) opens to edit data on the induction database. There's a command button along side the original form (frmCoC) to create a new entry in the induction database. The click event for the button is as follows:
View Replies!
View Related
Error 91 Object Variable Or With Block Variable Not Set
At a high-level: My code fails in the sub-routine that is called (SecondSub). The first line of code on the SecondSub is where I get the Error 91 Object Variable or with block variable not set. 1st Routine: ________________________________________________________ Sub FirstSub() Dim ie As Object, iebody As String, strURL As String, strUsername As String, strPassword As String Dim lRow As Long Dim abc As String Dim striEst As String Dim ele As Object Dim LinkHref As String Dim a As String Dim b As String Dim c As String a = DateAdd("d", -1, Now) b = DateAdd("d", -2, Now) c = DateAdd("d", -3, Now) Set ie = CreateObject("InternetExplorer.Application") strURL = "website" strUsername = "xxxxxxxxxxx" strPassword = "xxxxxxxxxxx" While ie.busy DoEvents Wend......................
View Replies!
View Related
CreateObject: Object Variable Or With Block Variable Not Set
I have my below code which will create a looping "ftp" and "get" effect. However i am having some problems right now. There's always an error that states "Object variable or With block variable not set". Sub File_Transfer_testing() Dim N As Integer Dim Lotid As Variant Dim Tester_array(1 To 15) As String Tester_array(1) = "10.10.10.10" Tester_array(2) = "20.20.20.20" Lotid = InputBox("Input a LOT ID") N = 1 Set fs = CreateObject("Scripting.FileSystemObject") Set A = fs.CreateTextFile("C:script.txt", True) For N = 1 To 2 A.writeline "open " & Tester_array(N) A.writeline "xxx" 'username A.writeline "xxxxxx" 'password A.writeline "cd /zzz/reports" A.writeline "prompt" A.writeline "ascii" A.writeline "mget " & Lotid & "*sorts" 'file to be uploaded A.writeline "quit" A.Close Set fs = CreateObject("Scripting.FileSystemObject") Set A = fs.CreateTextFile("C: upload.bat", True) A.writeline "ftp -s:C:script.txt" 'the ftp site A.Close dRetVal = Shell("C:upload.bat", 0) 'upload the file ''''''''''end upload.bat file Next MsgBox ("Done") End Sub
View Replies!
View Related
Set Range Variable Using Variable Row Number
I am using a variable named " Totals" as a range type to refference the range in a formula. It works the way I have it. Dim Totals As Range Set Totals = [U37: AE37] Now instead of the absolute refference, I would like to change the row refference by an offset of my current row, using a formula with a varriable. The columns stay the same.
View Replies!
View Related
Unable To Set ColorIndex Property Of Interior Class: Fill Cell Color Macro
I have an error message that says: Run time error '1004': Unable to set the colorIndex property of the interior class. I attached code for your reference. If (Range("B10").Value = "Gift" Or Range("B10").Value = "Entertainment") And Range("C10").Value = "" Then Range("C10").Interior.ColorIndex = 6 MsgBox "Please Fill in the Person's Name & Company." Range("C10").Select Range("C10").Interior.ColorIndex = 6 End If
View Replies!
View Related
Forms Toolbar Versus Control Toolbox Toolbar
which of these toolbars provides the better 'controls' to paste onto worksheets (as opposed to UserForms)? For those wondering, both toolbars contain some apparently similar controls, e.g., combo box, radio button, spinner etc. but there are differences in their behaviour it would seem...
View Replies!
View Related
Object Variable Or With Block Variable Not Set
I have created a form, that users will use to input data. I want to provide a template excel workbook, that they are supposed to copy, and save with their own file name leaving the template untouched. The following code is supposed to check to see if this is the template workbook, and if so, it will open an worksheet (otherwise hidden) to allow them to do a "save as". Everytime I try to run the code I get the following error..."object variable or With block variable not set" and I don't know what I'm doing wrong. The only thing I did find was if I removed the "unload me" I didn't get the error. However, I need the form to unload so that the user can save the file under a new name.
View Replies!
View Related
Object Variable Or With Block Variable Not Set ...
I am trying to call one webMethods service from excel. The code is generated by webMethods. I can compile the code without any error. But while running the code I am getting this error "Object variable or with block variable not set". Option Explicit Private wc As Context Private CError As String Private outputs As New Values Private isConnected As Boolean Public Function TestWebServie(in_name As Variant) As String On Error Goto Err_TestWebServie Dim inputs As New Values If isConnected = False Then CError = Connect End If If Len(CError) = 0 Then inputs.put " name", in_name setStatus ("Invoking service Default.SukantaTestWebServie...") Set outputs = wc.invoke("Default.Sukanta", "TestWebServie", inputs) Else TestWebServie = CError End If clearStatus...........
View Replies!
View Related
To Set Focus To The RefEdit Control In Userform
I am trying to implement a simple userform using the RefEdit control. So I have the RefEdit control and an Ok (which has code attached to it) and a Cancel commandbutton. For some reason, I can't get the focus on the RefEdit control (i.e. when I activate the form, I have to actually click in the RefEdit box before it gets the cursor). Which property sets the focus in this control? Right now I have the Ok button Default property set to True. I have a commandbutton on the spreadsheet that activates the userform.
View Replies!
View Related
Pivot Chart Error: Unable To Set The _Default Property Of The Pivot Item Class
I have created quite a nice little macro that; drills through a lot of key figures, updates a pivot chart and copies the chart to powerpoint. However it crashes on one particular data set every time with this error: Run-time error '1004': Unable to set the _Default property of the pivot item class The code where the debugger stops is the last line below here. lngKpi = Sheets("Helpfile"). Cells(lngRow, 2) Sheets("Charts").Select ActiveSheet.ChartObjects("DK").Activate ActiveChart.PivotLayout.PivotTable.PivotFields("KPI # (overall").CurrentPage = lngKpi I can manually change the pivot chart to the keyfigure it crashes on and thereby workaround the problem in the macro. Also it works for more than 50 other keyfigures without problems.
View Replies!
View Related
Runtime Error 91 "Object Variable Or With Block Variable Not Set"
Hit a runtime error 91 "Object variable or With block variable not set" at the Loop Until Point. Private Sub UpdateOldPL() Dim n As Range, gg As String Dim Delete As String Delete = "CHECK" With Range("C5:C65536") Set n = . Find(Delete) If n Is Nothing Then Exit Sub gg = n.Address Do n.Offset(0, -1).FormulaR1C1 = "=VLOOKUP(RC[-1],'Unrlized_P&L(Dt_of_Rpt)_t-1'!C[-1]:C[9],2,0)" n.Offset(0, 3).FormulaR1C1 = "=0-VLOOKUP(RC[-5],'Unrlized_P&L(Dt_of_Rpt)_t-1'!C[-5]:C[5],10,0)/1000" n.Offset(0, 4).FormulaR1C1 = "=0-VLOOKUP(RC[-6],'Unrlized_P&L(Dt_of_Rpt)_t-1'!C[-6]:C[4],11,0)/1000" n.Offset(0, 5).Value = "SOLD" n.Value = 0 Set n = .FindNext(n) Loop Until gg = n.Address End With End Sub
View Replies!
View Related
Set Label Control Captions To A Cell Text/Value
I have an excel application that I'm developing that is going to be used by two different departments. On one side everything will pretty much be userforms. The sheets they the data I need to pull in for them is on sheets that I have such that their visibilty is equal too xlveryhidden. I'm trying to change the captions on labels using the data on the veryhidden sheets. Something like this. 'frmCurrentProposal is a userform 'lbGroupName and lbGroupNum are both labels that should vary frmCurrentProposal.Show frmCurrentProposal.lbGroupName.Caption = Sheet2. Range("B2").Value frmCurrentProposal.lbGroupNum.Caption = "Group # " & Sheet2.Range("B3").Value The labels are not changing their values.
View Replies!
View Related
Value For Variable Based Off Control Checkbox.
I have several checkboxs in an excel sheet, that if one is checked i would like it to make a change to a variable in a macro that will run when saving a file. for an example: if checked: Checkbox1 = NCE1 Checkbox2 = NCE2 Checkbox3 = NCE3 Checkbox4 = NCE4 Checkbox5 = NCE5 I have a bit of code that is like this.... ActiveWorkbook.SaveAs ("\marketing2PartageNonconforms" & sF1 & " - CO" & sF2 & " - FC" & sF3 & ".xls") I would like sF1 to change depending on which checkbox is checked. so if checkbox1 is checked, than sF1 = NCE1 .
View Replies!
View Related
Set Text & Hide Control On UserForm Show/Load
I'm trying to do is set up a form load event to initlize some controls. Here is my Private Sub Form_Load() 'Initialize the form lblProcessing.Visible = False txtFileName.Text = "Enter a file name" End Sub At the moment, this event is not triggering. I have the code in the code behind my form - should it be in a module? PS: This site is great - it's answered a lot of my other questions so far without me having to make any posts.
View Replies!
View Related
Find And Find Again - Object Variable Or With Block Variable Not Set
After doing a search, I need to ask an Excel 2003 question. I'm creating a tool to open three sparate workbooks. One is the driver and I need to use it to pull data from the second and then to place that data along with additional data into the third. My driver data may consist of a single value or multiple values separated by semi-colons in a cell. A single value works fine. The first value in a multi-value condition works fine. the second find, however, gives me an object error. I'm using the " split" verb to separate the values. Here's my code. Have you any idea why the second find is throwing up this error when the first find works correctly? varData = Split(strRef, ";", -1) For J = 0 To UBound(varData) varSrchVlu = Trim(varData(J)) ' do the ARIS Exrtact matching Workbooks(strManualFile).Activate Workbooks(strARISExtract).Activate ' Activate ARIS Extract Sheets("Processes").Cells(2, 1).Activate Workbooks(strARISExtract).Sheets("Processes").Range("A2").Select Workbooks(strARISExtract).Sheets("Processes").Columns("A:A").Select
View Replies!
View Related
|