Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default Add User from a UserForm

I'm trying to add a user via an UserForm. I've been using this code for
ComboBoxes but it errors out for my textbox. When it runs, the error message
is

"Run-time error '1004': Method 'Range' of object '_Worksheet' failed"
The debugger points to this line
Sheet2.Range("H" & found).Value = UserForm1.TextBox9.Value

I can't find out why 'found' doesn't have a value. Any thoughts. The full
code is below.



Private Sub CommandButton12_Click()

'Add new user

test_row = 2
test_value = Sheet2.Range("H" & test_row).Value

While test_value < ""
If test_value = UserForm1.TextBox9.Value Then
found = test_row
GoTo leaveloop1
End If
test_row = test_row + 1
test_value = Sheet2.Range("H" & test_row).Value
Wend

leaveloop1:

Sheet2.Range("H" & found).Value = UserForm1.TextBox9.Value

ComboBoxRefresh

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Add User from a UserForm

Private Sub CommandButton12_Click()

'Add new user

test_row = 2
test_value = Sheet2.Range("H" & test_row).Value

While test_value < ""
If test_value = UserForm1.TextBox9.Value Then
found = test_row
GoTo leaveloop1
End If
test_row = test_row + 1
test_value = Sheet2.Range("H" & test_row).Value
Wend

leaveloop1:
if found 1 then
Sheet2.Range("H" & found).Value = UserForm1.TextBox9.Value
else
Sheet2.Range("H" & Test_Row).Value = UserForm1.TextBox9.Value
End if
ComboBoxRefresh

End Sub

--
Regards,
Tom Ogilvy

"Chris" wrote:

I'm trying to add a user via an UserForm. I've been using this code for
ComboBoxes but it errors out for my textbox. When it runs, the error message
is

"Run-time error '1004': Method 'Range' of object '_Worksheet' failed"
The debugger points to this line
Sheet2.Range("H" & found).Value = UserForm1.TextBox9.Value

I can't find out why 'found' doesn't have a value. Any thoughts. The full
code is below.



Private Sub CommandButton12_Click()

'Add new user

test_row = 2
test_value = Sheet2.Range("H" & test_row).Value

While test_value < ""
If test_value = UserForm1.TextBox9.Value Then
found = test_row
GoTo leaveloop1
End If
test_row = test_row + 1
test_value = Sheet2.Range("H" & test_row).Value
Wend

leaveloop1:

Sheet2.Range("H" & found).Value = UserForm1.TextBox9.Value

ComboBoxRefresh

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default Add User from a UserForm

Wahoo! That worked thanks!

"Tom Ogilvy" wrote:

Private Sub CommandButton12_Click()

'Add new user

test_row = 2
test_value = Sheet2.Range("H" & test_row).Value

While test_value < ""
If test_value = UserForm1.TextBox9.Value Then
found = test_row
GoTo leaveloop1
End If
test_row = test_row + 1
test_value = Sheet2.Range("H" & test_row).Value
Wend

leaveloop1:
if found 1 then
Sheet2.Range("H" & found).Value = UserForm1.TextBox9.Value
else
Sheet2.Range("H" & Test_Row).Value = UserForm1.TextBox9.Value
End if
ComboBoxRefresh

End Sub

--
Regards,
Tom Ogilvy

"Chris" wrote:

I'm trying to add a user via an UserForm. I've been using this code for
ComboBoxes but it errors out for my textbox. When it runs, the error message
is

"Run-time error '1004': Method 'Range' of object '_Worksheet' failed"
The debugger points to this line
Sheet2.Range("H" & found).Value = UserForm1.TextBox9.Value

I can't find out why 'found' doesn't have a value. Any thoughts. The full
code is below.



Private Sub CommandButton12_Click()

'Add new user

test_row = 2
test_value = Sheet2.Range("H" & test_row).Value

While test_value < ""
If test_value = UserForm1.TextBox9.Value Then
found = test_row
GoTo leaveloop1
End If
test_row = test_row + 1
test_value = Sheet2.Range("H" & test_row).Value
Wend

leaveloop1:

Sheet2.Range("H" & found).Value = UserForm1.TextBox9.Value

ComboBoxRefresh

End Sub

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
multiple user in excel to edit a userform Rachel Excel Discussion (Misc queries) 2 November 25th 08 04:47 PM
Userform doesn't recognize other user form upon re-load Cheryl Excel Programming 1 August 20th 04 10:43 PM
How to keep the Checkboxes selected by the user unchanged even after closing the userform Harinath Excel Programming 5 April 14th 04 09:19 AM
How to keep a Userform available while the user interacts with a spreadsheet Tom Ogilvy Excel Programming 1 September 10th 03 01:26 PM
How to get User input from Userform Text box K[_3_] Excel Programming 1 September 9th 03 10:08 PM


All times are GMT +1. The time now is 07:09 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"