I want to basically set a varible that can be called back into a multiple of documents I will try and explain this as best as I can but it is a fortnightly pay date... i.e. 22/04/2009 Wednesday... as the payroll is fortnightly I want to be able to use the current date or todays date in a future proof macro.
i.e. if todays date is the 14/04/09 then the next pay date has to be the 22/04/09, if this was run in two weeks it would be 06/05/2009.
I was thinking a long the lines of lock in one start date... 14/01/09, then adding increments of 14 days until todays date - variable + 14 * r = "-"
I have 800+ files the problem is that the file name ends in 80 different combination so I need to try all of those for each file.
eg: one of the 800 is "109 st no 103 av" the file could be called: "109 st no 103 av nb1_cleaned.xls" or "109 st no 103 av nb 1_cleaned.xls" or "109 st no 103 av nb 1._cleaned.xls" or "109 st no 103 av sb1_cleaned.xls" . . . .etc
I wrote a code to try all those combinations, the issue lies a space the code adds before _cleaned, how to remove it?.
So the name should be "109 st no 103 av nb1_cleaned.xls" but my code is letting it be 109 st no 103 av nb1 _cleaned.xls
I have data from 100 trials. Each trial has a variable number of data points (rows), but each row is labeled in the first column with the trial number. I would like a macro to identify the first row of each trial, calculate the difference of the value of the cell in column G of that row from a constant (718), and then add that difference to that cell and all other cells in that column of that trial.
So based on the attached sample, I would like all values in column G for trial 2 to be +1, for trial 3 to be -5, and for trial 4 to be +2.
In the file, I've cleared all the data from the impertinent columns. Eventually, I will also want to perform a similar process on column H but with a different constant.
I have a userForm (Form1) that contains a persons name that I would like to reference in a separate UserForm (Form2). In the separate UserForm (Form2) I need to reference this persons name many times, so I was wondering if there was a was to declare this name in the separate UserForm (Form2) as a constant. Only thing is that a constant, to the best of my knowledge, must be an expression and not a variable. Mainly, I'm trying to avoid declaring the myName variable in each Sub within Form2, which it will be needed for a ton of Sub's.
Code for Form2: Const myName As String = Form1.txtName.Value
I am trying to write a macro which will autofill specific columns. The macro will set the range from the start of my autofill to the end of my autofill as a constant range.
The problem I need to get around is the end of my range can always change each time I run the macro. For instance, the first time I run the macro I may only need to autofill from row 4 to row 15. The next time, I may only need to autofill from row 4 to 23 (because of user updates). How can I make the end of my range not be a constant address but variable?
I need an equation that lets me determine whether a cell contains a static constant value (either a string or a number), or an equation that generates a value.
Problem: I have a cell that contains a default equation that generates a default value, depending on a few conditions. The user can overwrite this cell with a constant. In another cell I need to know whether that cell is still the default equation or a new constant value.
I cannot simply test the value of the contents to see if they match my default, because the user may choose to enter that value.
I am creating on the fly an array (2 columns) in which the one row cell is mathematically derived from its neighbor (A left-hand cell). However, when the mathematically derived product exceeds a value, the row neighbor changes to another constant until its neighbor's product exceeds another value, etc. Can I create such an array without resorting to VBA?
So I have module1 -> Sub Macro1() module2 -> Sub Macro2() module3 -> Sub Macro3() module4 -> Sub Macro4()
I have declared
Dim mdNextTime1 As Double Dim myEnter As Integer 'Dim myK1 As Integer 'Dim myK2 As Integer 'Dim myK3 As Integer Dim myK4 As Integer Const myC As Integer = 82 Dim Lastrow As Integer Dim myActualRow As Integer
Option Explicit Public Const ARK As String = "Inddata-ARK" Public Const VVS As String = "Inddata-VVS" Public Const KON As String = "Inddata-KON" Public Const EL As String = "Inddata-EL" Public Const LD As String = "Inddata-LD" Public Const KØL As String = "Inddata-KØL" Public Const OpDat As String = "Opdatering"
And then macro's under it... So the aboce is in module "INIT_S". Now in another module "RUN_P" I have a sub-rutine that uses these constants with a select case. Likes this:
Sub OpEksInitNu() Select Case ActiveSheet. Name Case ARK With OpEks 'more stuff Case VVS 'more stuff Case KON 'more stuff End Sub
But when I try to run OpEksInitNu i comes with ambigious name with ARK as the error, later down I use another public constant. But i keep getting the ambigious name error.. What could cause that... I have tried to locate all ARK, VVS etc. to try to determine if it is used later on, but it's not! I only declare the constants one time, and no module is called ARK, VVS etc.
I'm looking to run several subs in a module which all refer to the same constant but I'm having difficulty defining that constant in a way that the various subs will accept. Basically I'm trying to define a constant LastRow. I am fairly new to VBA so am not sure whether to use a Get LastRow public property (which I tried to use and failed) or a Function and then how to make this readable by all the subs.
I have sales per month going down a column and I would like to subtract a corresponding $ amount going across columns. It's hard to explain but I would like a formula that I can populate all of the cells with. Spreadsheet should make it clearer.
Ok, I have a spreadsheet that I use to track the majority of my work throughout the day. I have about 10 columns that I use for my own information, and about 4 of them that my colleagues need updates on. I have one sheet "worktracking" and another sheet "printable." Printable has just the 4 columns of info that my colleagues might need, formatted in a way that prints out nicely. Each column in "printable" references a column in "work tracking" like this
Now the problem that I'm running into is that I routinely delete rows from the "worktracking" sheet, which results in a reference error on the "printable" sheet. I am wondering if there is a way to rework it, such that when I delete a row from "worktracking," then "printable" just does the same, and only retains rows that have data in them...