Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I got help in a previous post. instead of using a series of input boxes to
gather information i'm using a userform. so with this userform the user inputs information into each given area adn then it inserts that inforation into the next available row. however the user form has two tabs one to add new information and one to alter information. on the alter tab the user puts in a series of numbers and puts in information they want to change associated with the number they put in. so the part i'm stuck in is when they click the "alter" button i inserted i want the userform to search the spreadsheet for that first number, once it finds it it inputs the new data in the appropriate columns on that row next to the first column. so basically the macro associated with this userform will find the first number inputed by the user in the spreadsheet, once found it will change the information next to it...any suggestions? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If I were using the code with inputboxes, this is how I'd use it:
Option Explicit Public Sub getdata() Dim nextrow As Long Dim entry1 As String, entry2 As String, entry3 As String Dim entry4 As String, entry5 As String Dim res As Variant Do entry1 = InputBox("What is the HFC MAC?", "HFC") If entry1 = "" Then Exit Sub res = Application.Match(entry1, Range("a:a"), 0) If IsError(res) Then 'not already in the list nextrow = Range("A65536").End(xlUp).Row + 1 Else nextrow = res End If entry2 = InputBox("What kind of modem is it?") If entry2 = "" Then entry2 = Cells(nextrow - 1, 2).Value entry3 = InputBox("Where is the modem? Default is 'Shelved'") If entry3 = "" Then entry3 = "Shelved" '<--typo! entry4 = InputBox("What's the status of the modem: Renting," _ & " Purchased or Pending. Default is 'Pending'") If entry4 = "" Then entry4 = "Pending" entry5 = InputBox("What is today's date?", Default:=Date) If entry5 = "" Then entry5 = Cells(nextrow - 1, 5).Value Cells(nextrow, 1) = entry1 Cells(nextrow, 2) = entry2 Cells(nextrow, 3) = entry3 Cells(nextrow, 4) = entry4 Cells(nextrow, 5) = entry5 Loop End Sub You can use application.match to see if the entry is there and to determine the row where it resides. Maybe you can include some of this stuff in your userform code. chip_pyp wrote: I got help in a previous post. instead of using a series of input boxes to gather information i'm using a userform. so with this userform the user inputs information into each given area adn then it inserts that inforation into the next available row. however the user form has two tabs one to add new information and one to alter information. on the alter tab the user puts in a series of numbers and puts in information they want to change associated with the number they put in. so the part i'm stuck in is when they click the "alter" button i inserted i want the userform to search the spreadsheet for that first number, once it finds it it inputs the new data in the appropriate columns on that row next to the first column. so basically the macro associated with this userform will find the first number inputed by the user in the spreadsheet, once found it will change the information next to it...any suggestions? -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you very much Dave. You have been most helpful in many of my posts.
Thanks again! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Closing File Error | Excel Discussion (Misc queries) | |||
Highlight Range - wrong macro, please edit. | Excel Worksheet Functions | |||
macro with F9 | Excel Discussion (Misc queries) | |||
Make Alignment options under format cells available as shortcut | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) |