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
quot;alterquot; 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?
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(quot;What is the HFC MAC?quot;, quot;HFCquot;)
If entry1 = quot;quot; Then Exit Sub
res = Application.Match(entry1, Range(quot;a:aquot;), 0)
If IsError(res) Then
'not already in the list
nextrow = Range(quot;A65536quot;).End(xlUp).Row 1
Else
nextrow = res
End If
entry2 = InputBox(quot;What kind of modem is it?quot;)
If entry2 = quot;quot; Then entry2 = Cells(nextrow - 1, 2).Value
entry3 = InputBox(quot;Where is the modem? Default is 'Shelved'quot;)
If entry3 = quot;quot; Then entry3 = quot;Shelvedquot; 'lt;--typo!
entry4 = InputBox(quot;What's the status of the modem: Renting,quot; _
amp; quot; Purchased or Pending. Default is 'Pending'quot;)
If entry4 = quot;quot; Then entry4 = quot;Pendingquot;
entry5 = InputBox(quot;What is today's date?quot;, Default:=Date)
If entry5 = quot;quot; 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:
gt;
gt; I got help in a previous post. instead of using a series of input boxes to
gt; gather information i'm using a userform. so with this userform the user
gt; inputs information into each given area adn then it inserts that inforation
gt; into the next available row. however the user form has two tabs one to add
gt; new information and one to alter information. on the alter tab the user puts
gt; in a series of numbers and puts in information they want to change associated
gt; with the number they put in. so the part i'm stuck in is when they click the
gt; quot;alterquot; button i inserted i want the userform to search the spreadsheet for
gt; that first number, once it finds it it inputs the new data in the appropriate
gt; columns on that row next to the first column. so basically the macro
gt; associated with this userform will find the first number inputed by the user
gt; in the spreadsheet, once found it will change the information next to
gt; it...any suggestions?
--
Dave Peterson
Thank you very much Dave. You have been most helpful in many of my posts.
Thanks again!
- Dec 25 Tue 2007 20:41
Still stuck on macro...
close
全站熱搜
留言列表
發表留言