i've got a sample database (attached) with a userform for inputting of data. What i want it to do is automatically generate the next number and add it to textbox "our ref" on the userform. the number is in Col C. This is the code i've tried using the code highlighted in red which doesnt work.
Code: Private Sub cmdSearchButton_Click() Dim txtbox As String 'stores lookup value Dim x As Variant 'value for wwid txt box Dim ForeName As String Dim SurName As String Dim wwid As Variant Dim iPosition As Integer
Here is my code, it does a vlookup and if the persons name is not found it will split the text entered into forename and surname but when i try and add
I am creating a userform in excel 2010 (64 bit) that is a 14 question survey. I am trying to get a simple datepicker to appear when user clicks or tabs into a designated textbox which I have named TextBoxDate. I would then like the user to select a date and for that date to appear in the dd/mm/yyyy format in the textbox. Should be easy, right?
I have tried downloading several datepickers, most from the open source thread Non-activex Datepicker Calendar Control on this site. But I am unable to successfully tweak the code to get the datepicker to work how I want. I also am not looking for a datepicker that is complex with max and min date ranges etc.
I am using a formula =SUMIF(B:B,B1,C:C) in an effort to return the total of those cells in column C where the value of B1 remains the same in column B. (did that make sense?). I've used a similar formula previously but on this occasion it returns an incorrect total.
I have a form that has three fields (1. Comments (TEXT), 2. Legacy_Comments (TEXT), 3, Comment date (DATE))
Now my users need to keep adding comments to the comment text box, and when they do it automatically adds the date they entered the comment in the Comment date box. Now my problem is that since they keep adding comments to the comment box, I need to keep track of these comments in the Legacy_Comments (Text box).
For example, the First time a user enters a comment into the (1) comment text box it auto populates the date in the comment date box, and then adds the comment and date to the Legacy_Comment box. the end result is (comment,4/3/2014 now lets say a user needs to add a comment to the comments box tomorrow - I want the legacy_Comment box to then read (comment, 4/3/2014; comment2, 4/4/2014, ...., comment(n),date(n)) OR it can be vice-verse, because I just need to keep track of the comments, I am not worried if the new comments are before or after older (yesterdays / the day before yesterdays comments)
How can I write a VBA code that will always add the new comment to the legacy_comment field, without deleting the comments that were entered previously?
Code: If isnull(me.comment.value) Then Exit Sub ElseIf me.comment.value = true Then me.comment_date.value = date me.legacy_comment.value = me.comment.value & "," & me.comment_date.value & ";" me.legacy_comment.value = me.legacy_comment.value & "," & me.comment_date.value & ";"
It adds the comment only the first time, but it does not concatenate the string from yesterday to the string to today. I do not care which order the comments are, meaning if I added a comment today it can be before OR after the comment from yesterday.
I need a userform textbox event that fires after I tab or click out of the textbox. Going by the list of options:Beforedragover, BeforeDroporPaste, Change, DblClick, DropButtonClick, Error, Keydown, Keypress, keyup, mousedown, mousemove, mouseup.
I can't figure out which one will do what I want. The change event happens instantaneously which doesn't work. I need to fire off the event when my focus leaves the textbox.
I tried looking for everywhere, but i still cant seem to find the solution.. I have an Active X textbox on a worksheet, and I need it's value to show up on a textbox on my userform, that shows up through a command button on that worksheet. I'm fairly new to vba.
I have a userform that I'm using to add data to a worksheet, with the following
Private Sub CommandButton1_Click() Dim OutSH As Worksheet Set OutSH = Sheets("Sheet1")
OutSH.Cells(nextrow2, 1).Value = Surname.Value OutSH.cells(nextrow2,2).value = ID.value OutSH.cells(nextrow2,3).value = Date.value ...... I need to ensure that duplicate entries are not made for the same person on the same date. The ID is unique to each person.
IF statement that can check for a duplicate and then come up with a dialouge box with some custom text, and then exiting the sub?
Basically I want to calculate each team's home winning/drawing/losing streak. Here is a sample of the table (I've simplified it a bit and added fictional results): (See Attached)
So, I want a formula that can tell me a given team's (e.g. Arsenal's) latest result, and how many previous consecutive results of that kind there have been. For example, for Arsenal, the result would be something like "W2" (i.e. Won the last two games). At the moment, the best I can do is to get the TOTAL NUMBER of a given team's latest result using this formula:
I have excel sheets with 71936 rows of data collected ~30 times a second for 40 minutes during and driving simulator drive (for 51 participants! all in separate worksheets). The output I get from the simulator includes speed, lane position etc. I've been averaging the data out into minute blocks for most variables, but what I really need to know is: if they exit the "lane" for more than 3 seconds, and if so, how many times they exit the lane in each minute.
Column A is the minute, column B is their lane position. Lane position ranges from -540 to 540. The middle of the left hand lane is -180 (the left hand lane ranges from -360 to 0 - we drive on the left in Australia). If they exit the left hand side of the lane, the lane position value will be between -360 and-540, and if they exit the right hand side the lane position value is 0 or greater.
A formula in a new column that can give a "1" each time they exit the lane for more than 3 seconds would be great, then I think I can make it sum how many times they do it in each minute.
In cells v43:v52 I have data which will change often the data is always either a 1,-1 or a 0, I need a way to count from the bottom up and ignore anything that is not part of the chain. It can also contain 0 in rows that are not populated yet but the 0s will always be on the bottom and never in the middle or top.
I.E. in 3 weeks it could be
1 1 1 0 0 0 0 0 0 0 0 0
I would want the formula to spit out 3 because it was 1 3 times in a row..
Now say in week 5 it is 1 1 1..............................
I have a spread sheet of hourly temperatures which is broken down into year, month, day, time, and temperatures. I would like to find the top ten longest stretches of sub-zero temperatures in number of hours and the time and date in which they started and ended. I have attached a spreadsheet for your perusal..
E20 with the series of numbers in tenth, and with five numbers on one cell. Between 01-37. How do I write a formula on column R to identify any repeated numbers from E20 with E21? In the chart it shows number 10 is repeated from E21, so I place a check mark on the same row as E20 on column R.
On column S how do I write a formula to identify numbers within E20 to see if there are any consecutive numbers? On E20 there is none, on E21 there is one 10-11, and column S will let me know if there is a consecutive by placing a check mark.
to create with the default excel functions the following calculator. I need to calculate the maximum number of positive numbers which happen in a row and the maximum number of consecutive negative numbers. For example in the following list of numbers there are a maximum of 7 consecutive positive and a maximum of 6 consecutive negative numbers:
Dim x& With Sheets("PLAYERS") For x = 1 To .Cells(Rows.Count, "C").End(xlUp).Row If .Cells(x, "C").Value = Me.ComboBox1.Value Then _ Me.TextBox3.Value = .Cells(x, "D").Value Me.TextBox26.Value = .Cells(x, "E").Value
I have the code below to add a text box to a tool bar. My question is can it be a updating text box such as the forms "TextBox1_Change"? I would like it so that as the user changes the text box it runs the Loc_Box sub. Example if "H" is in the text box and the user types "1" then Loc_Box runs, or "H" is deleted it runs, is this possible?
Set TB = CommandBars("Loc Box").Controls. _ ****Add(Type:=msoControlEdit) With TB ****.OnAction = "Loc_Box" ****.Caption = "Loc Box" ****.Width = 100 End With
I'm looking at test results and would like to know how many times in a row correct answers were given before getting one incorrect. The way I have this currently set up, is if a student has the answer correct it returns a "TRUE" value, and a "FALSE" value for an incorrect answer. A typical test may have 50 questions, so I would have either "TRUE" or "FALSE" values in rows A1 through A50.
So I've been trying to figure out a formula that counts the number of times "TRUE" rows repeat 'consecutively' in a given column, in this scenario column A. The formula would need to check the current row and if "TRUE" check the row immediately after, if that row is also "TRUE" then check the row immediately after that, until it runs into a "FALSE" string, then display that total count of consecutive "TRUES" in another cell. I understand there may be duplicate results but I'm only really interested in the longest value, so duplicates can be ignored.
If it makes the formula easier, each possible result can be assigned to it's own cell. Let's assume the test has 50 questions. So if a student got all 50 questions correct the result count would be 50 in cell B50, or if they got 25 correct before the first incorrect answer, cell B25 would say 25, etc. I'm guessing I could then easily query this column for the largest value to come up with what I need at a glance.