I copied this function from a VBA book and I get a Error 91 "object variable or with Block variable not set"
I have made sure that Microsoft scripting is referenced.
any clues would be appreciated.
I might add that this is a follow up on a thread I discussed with "Datasmart", thanks to John for getting me started.
Function BrowseForfolderShell() As String
Dim objshell As Object, objfolder As Object
Set obshell = CreateObject("Shell.Application")
'Uncomment next line to start at desktop
'Set objfolder = objshell.BrowseForFolder(0, "Please Select a Folder", 0, 0)
Set objfolder = objshell.BrowseForFolder(0, "Please select a Folder", 0, "c:")
If (Not objfolder Is Nothing) Then
I have attached a sample file where I want to concatenate data in colums A2:H2 into one column with line breaks. But CHAR(10) function alonwith CONCATENATE is not working. I have formatted the destination cell for wrap text.
This Trim funcion is not working for me for some reason. I have attached a sample file. Can someone help me with this? You can test the macro to see. I just want to delete the trailing blank characters on Column A. Here is the code.
I've written a Sub that separates words in a sentence into columns in an excel worksheet and it works perfectly. I can't however convert the convert it to a function procedure. when I do so I receive a Circular referencing problem or upon making necessary corrections to prevent circular referencing, I get the Excel #Value error. Here's the code:
Function TextToColumns(Txt) As String ' ' Enters Text Separated By Spaces Into Columns ' Dim i As Long Dim k As Long Dim cell As Range
I have a worksheet with dates on and have user form to display dates within a range. I have created some code, but the find function errors and says it cannot find this value on the sheet, but it is definatly there. This is my code: I have added an asterix to where it errors and says it cannot find the value
Code: Private Sub SearchButton_Click() Dim lbtarget As MSForms.ListBox Dim rngSource As Range Dim FoundFrom As Range Dim FoundTo As Range With Worksheets("Calender")
I got a problem with a macro i'm working on. I got column D which contains text as "Figures", "Toys", "3DS", "PS3" etc. I also got column N where i need the macro to display "Toys" if it's a toy, figure, etc; or "Games" if it's "PS3", "PS4" etc.
I'm using the following code, to also select only blank rows (so to ignore row 1 which is table header). Problem is that the result shows only "Games".
I'm in a workbook, and I want to look up a name. CTRLF or clicking on the binoculars both bring up the expected dialog box, but when I populate "Find What" and either hit enter, click Find All or Find Next, nothing happens.
The only thing I can think of is that I created a macro to function in one sheet only, then saved this workbook as .xlsm. But that doesn't seem right.
I have the following formula that has ceased to work in excel. I don't think there are any errors in it so I'm unsure as to why the link no longer works. Neither of the files I'm using has moved location on the server.
I have 3 worksheets for 3 separate managers, each sheet has a column which uses a COUNTBLANK function to work out the number of days off an employee has had off in the last two weeks:
Now the formula works perfectly on each worksheet, however I also have a master worksheet (which is identically set out and formatted to the 3 manager sheets) which uses a vlookup formula to pull the data from all 3 worksheets into one at the beginning of the workbook.
The problem I've come across is that the COUNTBLANK formula doesn't work on the master worksheet - I think this has something to do with the vlookup formula entered into the cells which I consider to be blank, but excel doesn't?
I've tried using a separate vlookup formula to pull the data from the 3 managers worksheets and this does work unless an employee appears on more than one managers' sheet - then the data from both worksheets is added together.....
Is there another function I could use to display the information I need to?
This is probably a really stupid question, but I can't for the life of me figure it out. I need to do some very basic filtering, but the dropdown box where you check off the things that you want to filter by is not defaulting to show checkboxes. This didn't seem like a big deal at first, but it's made it impossible to filter all but one things. For instance, to filter everything but values that are 0, I would have to manually click every single value in the dropdown box. Clicking "select all" is doing literally nothing. It's this way for all my excel documents. how to get the boxes back? I've included a screenshot of what comes up whenever I click on the manual filter button to show what is coming up.
I attempted to create a user function as per the link that VBA Noob posted in this post http://www.excelforum.com/excel-worksheet-functions/619446-resolved-play-a-sound-when-a-cell-equals-a-certain-value.html
I get #Name error. I placed the wav file Applause.wav in the same folder as the workbook. What did I do wrong?. Also, assuming I get this problem sorted out, how would I represent the condition "pass" or "fail" as in cell B3 in the Alarm formula? Would it be; Alarm(B3,"Pass") or Alarm(B3,"=Pass") or something else?
My Macro opens an excel file and I've to count the number of blank spaces for every filled column. I'm using CountBlank function for that.
But, the code fails at the countBlank line by saying Type Mismatch.
Sub Snippet_Code() Dim apdata as excel.application, wbdata as workbook
set apdata = new excel.application Set wbData = apData.Workbooks.Open(Filename:="ABCD.xlsx")
For colnum = 1 to 50 'Columns from 1 to 50
My code fails at the BlnkCnt part. I also tried assigning the two cell addresses in two variables and passing the variables to the range method. But there again, I get the error of Method Range of class _Global Failed.
I want to use TextToColumn function of excel using vba. I tried recording a macro to get the syntax and then make a few changes to it; But it is not working when i run it from vba ... if i do it manually it is working very nicely but it just skips that step in vba.
i have pasted my code
Code: On Error Resume Next rngReqIDcodWhole.TextToColumns Destination:=rngReqIDcodWhole, DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _ Semicolon:=False, Comma:=False, Space:=False, Other:="""", FieldInfo _ :=Array(1, 2), TrailingMinusNumbers:=True rngReqIDcodWhole is a column range
the text that the code needs to break is as follows
I'm new to the DMIN function and I'm having a problem.
Cell A2: Date (rest of column is date format) (heading for the column) Cell A2: Credit (rest of column is acctg. format) (heading for the column) Cell A2: Debit (rest of column is acctg. format) (heading for the column) Cell A2: Balance (rest of column is, equals balance field from previous row + credit - debit for current row, acctg. format) (heading for the column) Column E: Notes (rest of column is generic text) (heading for the column)
Cell K1: Date (the text "Date") Cell K2: > TODAY() (the text "> TODAY()") -- maybe this should be ="> TODAY()"?
Cell H2: =DMIN(A2:D1000,"Date",K1:K2)
I'm trying to get the minimum balance for the Balance column where the date is greater than today (lowest balance that I have in the future, which helps me see if I will be overdrafting).
I'm getting a value of 0 in H2. I have also tried =DMIN(A2:D1000,1,K1:K2) and get the same result.
I have just built a spreadsheet to calculate training hours amongst other things. I have used the function NETWORKDAYS which calculates the number of working days between two dates. This works fine on my laptop which has the analysis tools pack installed. Unfortunately my work place IS policy wont allow the analysis pack to be installed so need to find away around this. Does anyone know a formula that will perform the same function as the NETWORKDAYS. THis is crucial to the accurate calculation of training hours.
I am trying to use the NETWORKDAYS function in excel to calculate the working days for my company. the problem is I m located in UAE and here Saturdays and Fridays are official days off for my company. Now the problem is that the excel have this built in function that Sunday and Saturdays are weekend days. I want to customize the function for my local days off for my company.
I have created worksheets search box and want to use Trim Function to avoid spacing error when user enter the sheets name they are looking for and also sheets name in the Activeworkbook.worksheets.name
There is a range of quarters and relevant dates like from and till - means if you have 1 Q 2009 => it means from 01.01.09 till 31.03.09. I would like to have following in my excel. There is a validation for selecting Q from list, once you select Q, there is LOOKUP function displaying from and till dates. But however it's not working, in same cases it's working, but in most cases the from/till period is not relevant to selected quarter.
I am trying to create a single cell formula that returns the min value of an array returned from a vlookup function. This is part of a more complex solution that I am trying to implement, but I think I have narrowed my problem down to this issue, so I have created a very simple example to demonstrate.
I have written a user-defined function that searches for a small range within a larger range. The function requires two input parameters: the range you are looking for, and the range you want to look within.
For example, I might look for the string of values in cells A1:D1 in a larger range E1:H20. The function returns the row number in the larger range where the smaller range is found.
My problem is this: The function is working fine when I call it from another sub procedure. However, when I try to run it as a worksheet function, I get a "#VALUE!" error. The function pops up in the "insert function" menu, and it prompts for the two input parameters.