I've been left with a macro built in 2010--but I need it to run in 2003.
I've identified a Remove Duplicates function as the cause of a bug, how to translate this to a 2003-friendly macro? This will be an action in a much longer macro. What I am trying to do is check for duplicates in a particular column (Column C), and remove any duplicate row (it doesn't matter which duplicate is removed).
I'm having a hard time figuring out how to use the SumProduct worksheet function in VBA. The below worksheet formula works: =SUMPRODUCT((accProv=D2)*(accFYE=E2)*(accAcc))
I've written some code to try to count the number of cells that are not empty and save the result as a variable but sometimes the code seems to think that the cells are empty even though they are not.
The code goes through rows 1 at a time and counts the quantity of cells that are not blank and compares them with a couple other values.
The strange thing is if I execute the actual function =COUNTA(with the range that I am selecting below) the COUNTA function works properly by itself in certain problematic sections of the worksheet.
This code below seems to work correctly most of the time but I've found a few instances where it is not properly counting non-blank cells:
why my QtyTests variable sometimes is saved as 0 even though there may be some cells that contain values?
Here is the expanded code:
Sub Macro() 'Global Variables Dim QtyTests As Integer, ReqTests As Integer, InitQty As Integer, Cork As String, Corktype As String Dim result As Long, x As Integer
I have found an addin (http://www.quantdec.com/Excel/smoothing.htm) that adds a worksheet function smoothing data. It operates with 2 arguments: - a range for the input data to smooth - a parameter detailing how to do the smoothing.
It outputs a matrix of smoothed results, and therefore requires the Ctrl-Shift-Enter on a spreadsheet. Until there no problem, the function works properly. However I need to repeat the process about 100 times. Therefore I extended my ranges to duplicate the calculations, and that also worked fine. But because I don't need the intermediate data (100 columns by 1000+ rows) and I don't like to wait 2 minutes for the calculations to finish each time I open the saved file again, I thought I could just use VBA and only output the final results.
This is how the working syntax is in a cell: =SMOOTH(B3:B1032, "5RSSH,5RSSH,>,5RSSH")
And there the nightmare starts : - I cannot apply it even once: I get a type mismatch whatever I do to calculate the range and put it as an argument of the function. I used a string to store the range name and use it as is (B3:B1032 or even "B3:B1032") or with the Range function Range("B3:B1032"). I even tried to put manually "B3:B1032" with the same result. First major issue
- Because the worksheet function requires a range, I cannot use an array, or at least I tried without success. Therefore I need to output the result on the worksheet each time it is processed, and reread it through the formula, for n times the loop is running for... Kind of inconvenient... So I tried to modify the original smooth() function to create a new one that would accept an array as argument instead of range, but with the same consequence: Type mismatch when I feed the new function with an array (which I checked contains the data to process).
I have tried an example I found somewhere using a built-in Excel Worksheet function MMult and it worked with ranges:
Sub SomeSub()
Dim xArray As Variant, yArray As Variant, zArray As Variant Dim Fn As Object Set Fn = Application.WorksheetFunction
What I am hoping to do is find the row associated with column C and row value from LU. I have a stop on the line and LU is properly valued but it won't do the match. Is my syntax wrong. I am leaving the match type blank as it defaults to 1 which is the value I want anyway.
I am trying to use VBA to find a value on a trendline. I have been unable to call the TREND function from Excel, and I can't see what I'm doing wrong. I'm using the following line of point25 = WorksheetFunction.TREND( Range("d2:d25"), Range("c2:c25"), 25)
I keep getting "Runtime error 1004 - Unable to get the Trend property of the WorksheetFunction class".
VBA will not allow the worksheet function MMult to be called during the subroutine. The error that flashes is: "Run-time error 1004. Unable to get the MMult property of the WorksheetFunction property"
I am having problems getting the code right for the WorksheetFunction. I have put a snip of the procedure below.
I have data that is sequentially entered into columns, always in rows 4 to 18 with the column ref increasing by 1 each time new data is entered.
After each instance of data entry into a new column I need to loop through that data and, if the a cell value matches a value in range A1:A200, to place x in column B in the same row as the match in column A. All in Sheet2.
Set cStartcell = Sheet2.Range("IV4").End(xlToLeft) ' goes to last entered column For Each cell In Sheet2.Range("B2:B200") Application.WorksheetFunction.If(Match(Offset.(0, -1), Sheet2.Range.("cStartCell:cStartCell.Offset(15, 0)"),""x"") Next
I have put the problem in bold. whatever I try seems to come up as 'end of statement expected' or 'identifier or bracketed expression expected' errors. When I have managed to get rid of errors the fromula does nothing.
Can you have a function create a new worksheet? i know this is possible with a Sub but i haven't been able to do this with a function. Example is below. I'm planning to call the function from an Excel cell (i.e. =CreateNewSheet())
Is there something I can program into my form so that when a record is added and the 'add' button is clicked, it not only adds the record to the work sheet but saves the workbook as well.
I have a spreadsheet with 5 worksheets representing the working days of the week. Each worksheet contains data pertaining to every occurance of that day for as long as it has been recorded. Each day is broken up into hourly data.
So for example, for Monday's worksheet, you would have
Col A..............Col B........Col C 9/jan/06........5am.........data 9/jan/06........6am.........data 9/jan/06........7am.........data ...etc....then... 2/jan/06........5am.........data 2/jan/06........6am.........data 2/jan/06........7am.........data ...etc....
We are trying to create a function, on another worksheet called Query. The only way I can describe what we want it to do is to do it in psuedocode.
I'm having a problem with the HYPERLINK function. I am trying to make jumps from an index sheet to the large worksheet with all the actual info in it. The name of the file is SKU and the large info sheet is also called SKU. First I took the SKU sheet and numbered the rows (="A"&CELL("row",A1)), then in the index worksheet I created a VLOOKUP that finds the corresponding chapter title and returns that value.
Worksheet 1
A B C 1 2 100 =VLOOKUP(A2,SKU!$A$1:$B$3,2,FALSE) ="[SKU]SKU!"&VLOOKUP(A2,SKU!$A$1:$B$3,2,FALSE) 3 150 =VLOOKUP(A3,SKU!$A$1:$B$3,2,FALSE) ="[SKU]SKU!"&VLOOKUP(A3,SKU!$A$1:$B$3,2,FALSE)
I used the HYPERLINK formula in column D: "=HYPERLINK(C2,A2)" and it returns something that looks like the right thing but the link won't open.
1) The cubic root of complex numbers "x+yi" are calculated using IMPOWER(). The w/s function appears to return incorrect values when the coefficients of the complex number are -ve.
2) For example: A1:: -8+0i B1::= IMPOWER(A1,1/3) the function returns: 1. + 1.7320508i instead of the correct value of -2.
3) The problem appears to be consistent with calculating theta [=atan(y/x)] as "pi" instead of "0" for the above example "-8+0i"
Runtime Error '1004' unable to locate the sum property of the worksheetfunction class
Public Function CalcSheet() Dim NoSales(0 To 11) As Range Dim DriveOffs(0 To 11) As Range Dim Voids(0 To 11) As Range Dim Shortages(0 To 11) As Range Dim tNoSales As Integer Dim tDriveOffs As Currency Dim tVoids As Currency Dim tShortages As Currency Dim X As Integer Dim NSc As Integer Dim DOc As Integer Dim VOc As Integer Dim SHc As Integer Dim aNoSales As Integer Dim aDriveOffs As Currency Dim aVoids As Currency Dim aShortages As Currency
I currently have a Tab named "Rent by Month 3-08-5-29" containing the monthly rent amount for 700 locations for March 2008 - May of 2029 with the layout seen below.
A B C D E Shop# 3/1/2008 4/1/2008 5/1/2008 6/1/2008 ETC.. 2 $5000 $5000 $5000 $5000 3 $3000 $3000 $3000 $3000 4 $7000 $7000 $7000 $7000 18 $4000 $4000 $4000 $4000 ETC... continuing down 700 rows and over 251 columns
What I need to do is convert this worksheet so it contains the same information but resembles the following layout. A B C Shop# Month Rent Amount 2 3/1/2008 $5000 2 4/1/2008 $5000 2 5/1/2008 $5000 2 6/1/2008 $5000 3 3/1/2008 $3000 3 4/1/2008 $3000 3 5/1/2008 $3000 3 6/1/2008 $3000 Etc....
I am trying to write a function in excel to use the worksheet function "small" In the vba immediate window it doesn't return anything and in the spreadshhet I get a # NAME? error when called in a cell the code is below.
Sub UseFunction() Dim myRange As Range Dim answer As Integer
Set myRange = Worksheets("Sheet1").Range("A1:F6") answer = Application.WorksheetFunction.Small((myRange), 1) MsgBox answer End Sub