i have compiled a multipage using some borrowed code and some code i have written myself. most of it works, but i have a problem populating listbox2.the error is in Private subCmbFindAllJobNo_Click(). i have put h1 tags around the line of code which shows the error when i debug. this code works ok as a stand alone, so i suspect i have done something wrong in the userform initialise.
Option Explicit Dim rng As Range Const FirstRow As Long = 2 Dim r As Long Dim ans As Variant Dim MyArray(100, 4)
I'm trying to do a simple loop which creates charts based on an ID number. I recorded a macro and has tried to modify it but am having trouble defining the correct reange when settign the data source. Here is my
Subcript Out Of Range Error Coming Now For The Code Which Works For Me Before
Dim rRange As Range, rCell As Range Dim strVal As String
Set rRange = Worksheets("WIED PROBLEM WELLS").Range("A11:A110")
For Each rCell In rRange strVal = rCell(1, 3) & rCell(1, 4) & rCell(1, 5) & rCell(1, 6) & rCell(1, 7) & rCell(1, 9) rCell.EntireRow.Hidden = strVal = vbNullString Next rCell
i am using the code above to hide the rows which doesn't have any values in all the following Cells 3,4,5,6,7 & 9 or Unhide the rows if there is value in any 1 of the following cells 3,4,5,6,7 & 9 from row number A11 to A110.
The same code works for me before. But now the code is not working. It says below the error message
Is there a setting within excel that could cause a user to get a run-time error 1004? I have a workbook with a macro that adds additional sheets to the workbook when a button is clicked. The thing works fine on my machine and 3 or 4 other machines that I have had guys test it out, but I have a user that it will not work for. He is at a location about 3 hours away so I cant see exactly what he is doing, but he says after he clicks the button he gets a run-time error 1004 that says "Unable to set the PrintQuality property of the Page Setup class". I'm thinking that it is a setting within excel?
We have a very long macro that at the end sends an email to each training coordinator. Within the body of the email, we want to autopopulate the completion status from a pivot table using getpivotdata.
We first try to set the variable but get an error: [compile error:invalid qualifier].
Sheets(Summary).Select Dim BDCompletion As String BDCompletion = Application.PivotTableSelection.GetPivotData(A3, "Business Dev Plan Found")
And this is how we plan to incorporate the variable into the body of the email:
With OutMail .To = "email@example.com" .CC = "" .BCC = "" .Subject = CurrentSheet.Name & " Training Plan Status as of " & Format(Now, "dd-mmm-yy") .Body = "BD is " & BDCompletion & " complete for 2007 Training Plans as of the date of this email." .Attachments.Add Destwb.FullName 'You can add other files also like this '.Attachments.Add ("C: est.txt") .Send 'or use .Display End With
How do you set the range with whats below? Right now its looking at 4,2 only and if extend to look all the way to 19,2 it will just copy the whole screen. I need it to look at 4,2 and then move to 5,2 and then so on once it has copied all that information to the sheet ...
This should be easy ... can't figure it out. If I want a formula that wants to perform an action (NPV, but I don't think that matters) on the cell directly above and the next "X" (say 20 cells/years of cash flow) to the right of it, how can I set it up so that I can copy the formula across as well as change "X".
(Obviously, it's easy to select a 20 cell range and copy it across ... but what if I want the length of the range to by dynamic (ie I want to switch to a 40 year NPV instead of a 20 year)?)
I am trying to set an Array to prompt user with a series of questions and input answers into a specific row. However, I want to skip over certain columns and leave those blank. How would I modify my code to do this?
Private Sub CommandButton2_Click() Dim ArrQues() As Variant Dim ArrInput(2) As Variant Dim lngLstRow As Long Dim strPNfromSales As String ArrQues = Array("Enter the Part Number.", _ "Quantity Being Returned?", _ "What is the Reason for Rejection?") For b = LBound(ArrQues) To UBound
I want the first two questions to be input into Column B & C, but then the third question to be input into column I.
Im trying to set a range using a named range and dont know the best way to do this. so far ive got
Set rDataRange = Range(Offset("datastart",1, 0) & ":" & Offset("datastart",LastRow, 0))
datastart is the named range in the sheet and im trying to make a new range that starts 1 row below where datastart is and end where lastrow is. not sure where i messed up on this but i get errors when i try to run this
I'm having trouble setting the Range "UtilizationRange" using a variable, "CurrentRange" to store that range. I get the error "Run-Time error 1004: Method 'Range' of object'_Global' failed".The rest of my code works when I set the utilization range using the actual range for my purposes, but the problem is the range will change each month and I don't want to change it manually each time. There's a cell in the excel sheet this refers to (AG3) that holds the range value, which in this case is [N7:N75], and I would just like to return that value to the variable "CurrentRange" and set UtilizationRange equal to that.
The value is returned to CurrentRange, but it's the last line that's giving me the problem.
Sub RangeTest()Dim UtilizationRange As Range, Cell As RangeDim CurrentRange As String CurrentRange = Range("AG3").Value MsgBox (CurrentRange) 'This returns the value [N7:N75], which is what I want Set UtilizationRange = Range("CurrentRange")End Sub
I have a certain number of accounts for opening and close dates. What I wish to acheive is to fill a Range of date from the opening to the closing (or up to 200606 YYYY-MM) in another spreadsheet with the account number corresponding to that date next to it.
The VBA I have right now manages to create the list of accounts but up till 2006. It isnt taking into consideration the closing dates of accounts.
So For example What I want is to set up inside of the loop that to continue to do the loop until it reaches the closing date by YYYY-MM so if the clossing date is 200504 I will have data filled up to that date, and if the closing date is "" then fill the dates up til 200606. Ive tried out a number of ways of inserting the if statement but apparently the string create a problem.
Here is my current VBA and a Sample Sheet of what it looks like....