Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JK JK is offline
external usenet poster
 
Posts: 78
Default Fill-in Range from UserForm

I would like to use a UserForm that allows the user to enter (for example) 1
wiget, 2 gadgets then have my procedure list that information in a range
like so:

NO ITEM
1 widget
2 gadget
3 gadget

I know this involves an array and am able to do the sequential numbering,
but have no idea how to include the correct count for the widgets and
gadgets. I would appreciate a lending hand. Thank you in advance.

Jim Kobzeff


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Fill-in Range from UserForm

JK:
Where or how is the information entered on your form? Do you have
seperate text boxes for NO & ITEM or are they together? Does the user
click a command button to enter the data to your sheet? What is the
name of the sheet? Are you using named ranges? If you can answer
these questions then maybe I can help...Mark

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Fill-in Range from UserForm

Dim j as long, i as Long, k as Long

j = 0
for k = 1 to 4 Step 2
for i = 1 to clng(Userform1.controls("Textbox" & k).Text)
j = j + 1
activecell.offset(j-1,1).Value = j
activeCell.offset(j-1,2).Value = _
Userform1.controls("TextBox" & k + 1).Text
Next i
Next k

ActiveCell.offset(j,0).Select


--
Regards,
Tom Ogilvy


"JK" wrote in message news:o3U3f.3674$2Y2.3307@trnddc05...
I would like to use a UserForm that allows the user to enter (for example)

1
wiget, 2 gadgets then have my procedure list that information in a range
like so:

NO ITEM
1 widget
2 gadget
3 gadget

I know this involves an array and am able to do the sequential numbering,
but have no idea how to include the correct count for the widgets and
gadgets. I would appreciate a lending hand. Thank you in advance.

Jim Kobzeff




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Fill-in Range from UserForm


Assumes the Userform is named Userform1:
1st textbox named TB1 and contains 1
2nd textbox named TB2 and contains "Widgets"
3rd textbox named TB3 and contains 2
4th textbox named TB4 and contains "Gadgets"

This worked for me:

Private Sub CommandButton1_Click()
Dim j As Long, k As Long, i As Long
j = 0
For k = 1 To 4 Step 2
For i = 1 To CLng(UserForm1.Controls("TB" & k).Text)
j = j + 1
ActiveCell.Offset(j - 1, 0).Value = j
ActiveCell.Offset(j - 1, 1).Value = _
UserForm1.Controls("TB" & k + 1).Text
Next i
Next k

ActiveCell.Offset(j, 0).Select

End Sub

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Dim j as long, i as Long, k as Long

j = 0
for k = 1 to 4 Step 2
for i = 1 to clng(Userform1.controls("Textbox" & k).Text)
j = j + 1
activecell.offset(j-1,1).Value = j
activeCell.offset(j-1,2).Value = _
Userform1.controls("TextBox" & k + 1).Text
Next i
Next k

ActiveCell.offset(j,0).Select


--
Regards,
Tom Ogilvy


"JK" wrote in message news:o3U3f.3674$2Y2.3307@trnddc05...
I would like to use a UserForm that allows the user to enter (for

example)
1
wiget, 2 gadgets then have my procedure list that information in a range
like so:

NO ITEM
1 widget
2 gadget
3 gadget

I know this involves an array and am able to do the sequential

numbering,
but have no idea how to include the correct count for the widgets and
gadgets. I would appreciate a lending hand. Thank you in advance.

Jim Kobzeff






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
SumIf - when I fill down the Range, Criteria & sum range changes markholt Excel Worksheet Functions 3 October 28th 08 12:37 AM
How to fill a range with data from another range? Themis Excel Discussion (Misc queries) 4 September 15th 05 07:29 PM
Range Values into userform Stuart[_21_] Excel Programming 5 March 24th 05 06:02 PM
UserForm to A Range Dan Gesshel Excel Programming 1 September 1st 03 07:08 AM
UserForm To A Range Dan Gesshel Excel Programming 2 August 29th 03 01:03 PM


All times are GMT +1. The time now is 05:01 AM.

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

About Us

"It's about Microsoft Excel"