Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform macro to recognise non-blank cell
Hi,
I would like a code to recognise the first non-blank cell and input the info into there via a userform. so the person enters the info into a userform and then each of the textboxes should go into specified cells in a new sheet. Each time new info is enterted the old info should still be there and the new one should go at the bottom of that etc. please can you kindly provide code for one textbox, i will replicate for the rest. thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform macro to recognise non-blank cell
I'm not 100% sure what your question is; but consider this in case it is
what you are looking for. The following code will keep adding the contents of TextBox1 to cell A1, one entry per line, every time it is executed. With Range("A1") If .Value < "" Then .Value = .Value & vbCrLf .Value = .Value & TextBox1.Value End With Rick "Zak" wrote in message ... Hi, I would like a code to recognise the first non-blank cell and input the info into there via a userform. so the person enters the info into a userform and then each of the textboxes should go into specified cells in a new sheet. Each time new info is enterted the old info should still be there and the new one should go at the bottom of that etc. please can you kindly provide code for one textbox, i will replicate for the rest. thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform macro to recognise non-blank cell
Hi,
I havent had a chance to test this yet but just to clarify on what i wanted.. i think the code will do what i want it to but just incase: This is what i want: When the user enters info the first time the info should go into cell A1 and when the second time info is entered it should go into cell B1, then C1, then D1 etc. will the code do this? thanks. "Rick Rothstein (MVP - VB)" wrote: I'm not 100% sure what your question is; but consider this in case it is what you are looking for. The following code will keep adding the contents of TextBox1 to cell A1, one entry per line, every time it is executed. With Range("A1") If .Value < "" Then .Value = .Value & vbCrLf .Value = .Value & TextBox1.Value End With Rick "Zak" wrote in message ... Hi, I would like a code to recognise the first non-blank cell and input the info into there via a userform. so the person enters the info into a userform and then each of the textboxes should go into specified cells in a new sheet. Each time new info is enterted the old info should still be there and the new one should go at the bottom of that etc. please can you kindly provide code for one textbox, i will replicate for the rest. thanks. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform macro to recognise non-blank cell
No, that is not what my code is doing; it is putting all the text in the
same cell. Now that I see what you want, give this code a try instead... Dim LastCell As Range Set LastCell = Cells(Rows.Count, "A").End(xlUp) LastCell.Offset(-(Len(LastCell.Value) 0), 0).Value = TextBox1.Value Rick "Zak" wrote in message ... Hi, I havent had a chance to test this yet but just to clarify on what i wanted.. i think the code will do what i want it to but just incase: This is what i want: When the user enters info the first time the info should go into cell A1 and when the second time info is entered it should go into cell B1, then C1, then D1 etc. will the code do this? thanks. "Rick Rothstein (MVP - VB)" wrote: I'm not 100% sure what your question is; but consider this in case it is what you are looking for. The following code will keep adding the contents of TextBox1 to cell A1, one entry per line, every time it is executed. With Range("A1") If .Value < "" Then .Value = .Value & vbCrLf .Value = .Value & TextBox1.Value End With Rick "Zak" wrote in message ... Hi, I would like a code to recognise the first non-blank cell and input the info into there via a userform. so the person enters the info into a userform and then each of the textboxes should go into specified cells in a new sheet. Each time new info is enterted the old info should still be there and the new one should go at the bottom of that etc. please can you kindly provide code for one textbox, i will replicate for the rest. thanks. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform macro to recognise non-blank cell
Hi,
I have tried the code. It executes fine with the OK button but it puts the stuff into the same sheet as the form. How can I tell it to put the info in a sheet called 'booking's? also, the form remains open I would like for it to close down once the user enters the info - a statement like 'unload me' or something? or is that for the cancel button? thanks alot. "Rick Rothstein (MVP - VB)" wrote: No, that is not what my code is doing; it is putting all the text in the same cell. Now that I see what you want, give this code a try instead... Dim LastCell As Range Set LastCell = Cells(Rows.Count, "A").End(xlUp) LastCell.Offset(-(Len(LastCell.Value) 0), 0).Value = TextBox1.Value Rick "Zak" wrote in message ... Hi, I havent had a chance to test this yet but just to clarify on what i wanted.. i think the code will do what i want it to but just incase: This is what i want: When the user enters info the first time the info should go into cell A1 and when the second time info is entered it should go into cell B1, then C1, then D1 etc. will the code do this? thanks. "Rick Rothstein (MVP - VB)" wrote: I'm not 100% sure what your question is; but consider this in case it is what you are looking for. The following code will keep adding the contents of TextBox1 to cell A1, one entry per line, every time it is executed. With Range("A1") If .Value < "" Then .Value = .Value & vbCrLf .Value = .Value & TextBox1.Value End With Rick "Zak" wrote in message ... Hi, I would like a code to recognise the first non-blank cell and input the info into there via a userform. so the person enters the info into a userform and then each of the textboxes should go into specified cells in a new sheet. Each time new info is enterted the old info should still be there and the new one should go at the bottom of that etc. please can you kindly provide code for one textbox, i will replicate for the rest. thanks. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform macro to recognise non-blank cell
Hi, sorry to bother you again but I just realised that the code does just half of what I want it to and thats probably because I didnt explain properly. When info is entered into textbox1 which is called first name this info should be placed in cell A1 in sheet bookings. The user will obviously populate all fields in the table and will go through the whole list of textboxes entering info - like first name, last name, dob etc etc. Each bit of info entered into each textbox should be placed into a corresponding cell into the sheet called bookings. so textbox 1 goes into cell A1, textbox2 in cell A2 and so on. Sorry to be a pain! Really appreciate your help. thanks. "Rick Rothstein (MVP - VB)" wrote: No, that is not what my code is doing; it is putting all the text in the same cell. Now that I see what you want, give this code a try instead... Dim LastCell As Range Set LastCell = Cells(Rows.Count, "A").End(xlUp) LastCell.Offset(-(Len(LastCell.Value) 0), 0).Value = TextBox1.Value Rick "Zak" wrote in message ... Hi, I havent had a chance to test this yet but just to clarify on what i wanted.. i think the code will do what i want it to but just incase: This is what i want: When the user enters info the first time the info should go into cell A1 and when the second time info is entered it should go into cell B1, then C1, then D1 etc. will the code do this? thanks. "Rick Rothstein (MVP - VB)" wrote: I'm not 100% sure what your question is; but consider this in case it is what you are looking for. The following code will keep adding the contents of TextBox1 to cell A1, one entry per line, every time it is executed. With Range("A1") If .Value < "" Then .Value = .Value & vbCrLf .Value = .Value & TextBox1.Value End With Rick "Zak" wrote in message ... Hi, I would like a code to recognise the first non-blank cell and input the info into there via a userform. so the person enters the info into a userform and then each of the textboxes should go into specified cells in a new sheet. Each time new info is enterted the old info should still be there and the new one should go at the bottom of that etc. please can you kindly provide code for one textbox, i will replicate for the rest. thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can Excel recognise cell contents as a cell reference | Excel Discussion (Misc queries) | |||
Start Cell B1 then find first blank cell, insert subtotal, next non blank, then next blank, sutotal cells in between......... | Excel Programming | |||
another macro is running ... how to recognise that process in code??? | Excel Programming | |||
Need macro to check if cell is not blank & previous cell is blank, copy information from row above & paste | Excel Programming | |||
Recognise filter in macro and ignore. | Excel Programming |