Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
chip_pyp
 
Posts: n/a
Default Still stuck on macro...

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   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Still stuck on macro...

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   Report Post  
Posted to microsoft.public.excel.misc
chip_pyp
 
Posts: n/a
Default Still stuck on macro...

Thank you very much Dave. You have been most helpful in many of my posts.
Thanks again!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Highlight Range - wrong macro, please edit. Danny Excel Worksheet Functions 8 October 19th 05 11:11 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 04:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"