Determine Last Used Row
Dec 12, 2007
i need to have this information entered in the row below each time which may or maynot be empty. i need a message box with error handling to ask if the user wants to enter more products or finish and another message box if the entries (which start at cell B4) go past B10 that they have to exit and start a new sheet. I have put the code below and attached the workbook so it may be of use to others
Option Explicit
Sub Locate(Name As String, Data As Range)
Dim rngFind As Range
Dim strFirstFind As String
With Data
Set rngFind = .Find(Name, LookIn:=xlValues, lookat:=xlPart)
If Not rngFind Is Nothing Then
strFirstFind = rngFind.Address
Do
If rngFind.Row > 1 Then
ListBox1.AddItem rngFind.Value
End If....................
View 5 Replies
ADVERTISEMENT
Sep 14, 2012
Right now in my code I'm using the below section to determine the column in which to search for dupes, and the last column of data for that range. However, I make the user select only part or one column through IF statements above, so there's no need for the user to input this information. I'd like to replace the choice part with and automated routine that determines the DupeCol from the column section selected, and determines the rowend from the last used cell to the right in the rows in that column selection. But I don't know how to do that and keep the values as strings.
VB:
Dim RowEnd As String, DupeCol As String
Dim LastRow As Long
DupeCol = InputBox("Type in the letter of the column you want to look for duplicates in.", "Fill in the Info")
RowEnd = InputBox("Type in the letter of the last column you want colored.", "Fill in the Info")
View 4 Replies
View Related
Jan 14, 2014
I have a big serie of charts (parabolas - open down) that i need to find the max value.
View 8 Replies
View Related
Jan 6, 2014
I would like to choose an option (C, Q, T) and get a result in 1 column.
In other words, if I type C in H6, I must get a different result in I6 as opposed to if I choose Q or T in the same column. However if I leave it blank I should have nothing or a 0 in I6.
In the attachment above you will see that I gave a sum for C (A3), Q (A4) and T (A5). The sum for each one is broken down into a percentage rate and a flat rate.
These rates are dependent on the initial amount entered into G6. C, Q, T stand for Cash, Cheques, Transfers. The form of transaction determines the % and flate rate to be charged.
View 11 Replies
View Related
Mar 21, 2006
I have a spreadsheet with Ethnicity (White, African American, hispanic,
Asian, other) in column A and Time (hh:mm:ss) in column B.
I trying to determine by how many White, for example, have spent less than 5
hours, >5 hrs but less than 10 hr, etc.
My plan is to make a chart of the data.
I've been looking at sumproduct and COUNTIF but I can't quite figure it out.
View 10 Replies
View Related
Mar 26, 2009
I'm working with box quantities and would like to get a formula that would take the box quantity and return the largest value based on some parameters. Here are my parameters:
Box Quantity
- 375 pieces
Break down options
2 - 187.5 pieces
3 - 125 pieces
4 - 93.75 pieces
5 - 75 pieces
Obviously options 2 and 4 are no good as I can only work with even break downs. This leaves me with either 3 or 4 and because I want the largest, I would choose number 3. What I need is help on a formula that will take the value of the box quantity and return the largest whole number. I think for the time being I would like to leave the break down between 2 and 5 as well.
View 5 Replies
View Related
Dec 13, 2011
What do I do if I want to determine whether an input is within a specified range, and then for there to be an output of a certain value from another cell?
For example, with tax brackets: if income (D) falls within B and C, return value A(from a separate column)?
Here is the data I have:
Column A
"Formula referencing D1"
"Formula referencing D1"
"Formula referencing D1"
"Formula referencing D1"
"Formula referencing D1"
[code]....
Column D, cell D1 is where you would input a number (income) Column E, cell E1 is where I want the output value.
Basically, what I would like is a formula to put into column E that will do two things. First, to determine if the value in D1 is within either (B1-C1, B2-C2, B3-C3, B4-C4, or B5-C5). Second, to then output the value of either A1, A2, A3, A4, or A5, for each respective range.
View 9 Replies
View Related
Feb 2, 2012
I want to write a function that goes out and reads a cell, waits a few seconds, then reads the cell again, since it is constantly changing. Then report back the difference between the two readings of the same cell. The following code does not work since t0 and t1 always come back the same value.
Code:
Function ReadTime(t)
t0 = t
DoEvents
Application.wait Now() + TimeValue("00:00:15")
t1 = t
ReadTime = t1 - t0
End Function
View 3 Replies
View Related
May 16, 2007
formula I can use to determine age between date of birth (in one cell) and an event date (in another cell)., i.e. birthdate 3/15/2000 with an event date of 3/2/2007.
View 9 Replies
View Related
Apr 5, 2009
I am having a bit of amnesia right now, but I know there are some smart cookies out there who can do this in a second or two.
I have a certain range in a worksheet (D6:D27). I need to find the first blank row, or the last row with data +1. I would like a worksheet function of some sort that might be used like this
=LastRow(D6:D27)
The result would be row 10 (the first blank row).
I have been searching for the past hour and just can not get anything to work right. I have tried many different suggestions, but I still draw a blank.
View 9 Replies
View Related
Nov 8, 2006
i have this code behind a command button in a userform
Private Sub cmdCalculate_Click()
If Me.txtLength.Value > "6.021" Then
lbM2.Caption = Val(txtHeight) * Val(txtLength)
End If
End Sub
the calculations work fine up till i enter anything over 9.999 in the textbox called "txtLength" Can any one see why this will not perform calculations when the entry is more than 9.999 in text box "txtLength"? i tried replacing the label control with a textbox!
View 4 Replies
View Related
Jan 20, 2007
Determine If A Number Is Even Or Odd. i would like to Determine If A Number Is Even Or Odd...?
View 3 Replies
View Related
Feb 14, 2007
I want to easily determine the max value of the stocks I own by only changing the daily value but i cannot bypass the circular reference problem. Example:
Stock|Today's Value| Max Value
A | 1 | 1
B | 3 | 3
Tomorrow i'm going to change today's value and my goal is that the max value remains unaltered if today's value is smaller. like this:
Stock|Today's Value| Max Value
A | 2 | 2
B | 1 | 3
View 4 Replies
View Related
Dec 4, 2007
at present i have the following code that does as intended.
If number < pr1 Then
number = 0
End If
how would i alter this so that it changes the 'number' if number is between pr1 and another number pr2?
View 9 Replies
View Related
Dec 20, 2007
I am working on a spreadsheet where individuals must enter a value between 1 - 4 or n/a. I would like to include a formula for each question where if they enter a value between 1-4, this scores 1 and if they enter n/a this scores 0. Does anyone know a simple formula I could use, I have tried IF formulas but keep getting muddled.
View 2 Replies
View Related
Jun 23, 2014
I have 4 TextBox on a UserForm. First three to enter value and the last one to return the lowest value entered in to the first Three TextBox. How to determine the lowest value and show it on last TextBox.
View 2 Replies
View Related
Feb 21, 2009
how can i get excel to read column c and return the answer into column f i have scores in column c that look like eg. 2-2 what i need excel to do is count the goals
in the example obviously 4 and then in column f if its over 2.5 return the value over but if its under 2.5 it returns under is this possible please given the format of column c?
View 14 Replies
View Related
Jun 9, 2009
I'm sure it is possible to solve this with an array, despite all my efforts having produced nothing so far. Attached is an example workbook. On the 'Data' sheet, every month the data will change and I need to fill in column A, with the approriate Name from the 'Map' sheet. Is this possible using an array?
View 3 Replies
View Related
Feb 11, 2010
I'm am trying to find some way to determine if a particular tab falls before/after/between other tabs in a workbook. For example, if I have a tab "Top" and a tab "Bottom", I want to be able to determine if tab X is between them.
View 14 Replies
View Related
Apr 3, 2014
Is there a way to automatically determine the final row number showing after a manual filter operation? Or maybe getting a list of the row numbers showing on the screen.
The project requires a macro that loops through only the rows of a filtered list, not all of the rows in the worksheet.
View 3 Replies
View Related
Apr 29, 2008
Is it possible to programmatically determine the page number on which a specific cell will print?
View 14 Replies
View Related
Oct 19, 2008
If I have a multiple workbooks open and I want to determine if a workbook is open for example "Test 1.xls", how would I do that. I want it to msgbox once to say "open" if open or msgbox "not open" if not open.
View 2 Replies
View Related
Sep 21, 2009
I managed to write my script with pretty much the info I could find on the forums (yes!) but I need to write my data to the last row. Columns A - D of the last row will be populated with the content of my variables. This little snipped gives me the first empty row:
View 5 Replies
View Related
Nov 2, 2009
Can anyone help me in finding how to write the command in VBA to determine what Cell was selected in a worksheet? The objective is to know what Cell has been selected by double click event to pop up a userform with a calendar from which the user can select the date. I am looking at making it dynamic so I do not select a particular range.
Can this be achieved? I guess yes, but how?
View 9 Replies
View Related
Feb 4, 2010
I have tried searching for a way for VBA to recognise in VBA if a cell contains any text, but most of my searches respond to specific cases for specific characters in a string
Basically, I'm just looking for the correct way to word a string of code that if it detects any text in column B (col 2 ) then it should not do anything, else it should cut the value in col 2 and paste it in col 8
View 8 Replies
View Related
May 15, 2009
Trying to do a simple workbook here, with hopefully no macros/VB script.
Essentially, I want a cell to display the row number (-1 to take into account the heading) which has the last value contained in it.
The workbook is a list of users that have signed up in 1 month, and is distributed to staff for a particular reason.
The cell I'm trying to create is part of a 'stats' section.
View 7 Replies
View Related
Dec 17, 2011
I have a macro which formats charts. It takes a user selected chart and formats it.
I would like to allow the user to select many charts and process them all at once (instead of just one at a time).
The problem is that when I have X charts selected in Excel, the Selection object assumes the "ChartObjects" type which includes all charts in the worksheet and not only those which are selected!
If I do "Selection.Count" it will count all charts (selected or not) and if I do "Selection.Item(x).Name" I can access any chart on the worksheet and not only those which are selected.
Questions:
1. Is there anyway to determine which charts are selected by the user? Either using the selection object or any other method?
2. When I select multiple objects (chart and non-charts), the selection object assumes the "DrawingObjects" type, which when counted returns the correct number of selected objects. However when I try to access them via "Selection.Item(x)" I again can access all DrawingObjects in the worksheet. Is there anyway to determine which drawing objects are selected? And access them (so I can determine whether they are charts)?
View 9 Replies
View Related
Jan 28, 2012
I have 2 stocks (A10 & A11)
Using VBA I want to check the table above to determine which lending percent each will be given.
View 3 Replies
View Related
Feb 27, 2012
I have 5 arrays, each containing 5 elements and want to determine all the combinations.
1 2 4 8 16
1 2 4 8 16
1 2 4 8 16
1 2 4 8 16
1 2 4 8 16
So, for example, we would start with the first element of the first line and work our way down through each subsequent line on the first column and wind up with combinations as follows:
1, 1, 1, 1, 1
2, 1, 1, 1, 1
4, 1, 1, 1, 1
8, 1, 1, 1, 1
16, 1, 1, 1, 1
Then, go down the second column starting with elements from the first array row:
1, 2, 1, 1, 1
2, 2, 1, 1, 1
4, 2, 1, 1, 1
8, 2, 1, 1, 1
16, 2, 1, 1, 1
In all, there will be 5^5 = 3125 possible combinations.
In addition, some elements in each of the 5 array rows may have a value of 0 instead of what is shown above. So, for example, the rows may appear as:
1, 2, 4, 0, 16
0, 2, 0, 8, 0
1, 0, 4, 8, 0
0, 2, 0, 0, 0
0, 0, 0, 8, 0
So, in essense, the first element in each array row may be either a 0 or 1, the second either a 0 or 2, the third either a 0 or 4, the fourth either a 0 or 8 and the fifth either a 0 or 16. If a zero appears in any of the combinations, I do not want the 0 entry to the list of combinations. So, for example, if a combination gives (from the first column above):
1, 0, 1, 0, 0, then I do not want to include the 0 as one of the combination elements and we would have as some of the possible combinations:
1, 2, 1, 2, 8
2, 2, 1, 2, 8
16, 8, 8, 2, 8....etc., but NOT 16, 8 , 8, 2, 0
either a VBA code or a way to hard-code in a worksheet with how this can be accomplished.
View 9 Replies
View Related
May 8, 2012
I need to run job between 4 July 2012 and 1 September 2012 but only Monday through Friday.
I have used weekdays() to find the name of dates between these two dates but need to narrow to Monday through Fridays.
View 1 Replies
View Related