LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Combobox question

Hi there, Im still pretty much a novice at this so please be gentle!
Ive been asked to automate the inputting into a stock file so I set up a
very basic sheet first (The actual file has 7 inputted columns and will be
run from a userform):
A
1 5001 100
2
3
4 5000 0
5 5001 100
......
10 5006 0

The macro I wrote was:
Public Sub QtyEnter()
Dim ThisCode, CodeRange As Range
Set ThisCode = Range("a1")
lastrow = Sheets("Sheet1").Range("A65536").End(xlUp).Row
Set CodeRange = Range("a4:a" & lastrow)
For Each c In CodeRange
If c.Value = ThisCode.Value Then
c.Offset(0, 1) = ThisCode.Offset(0, 1)
End If
Next
End Sub

Which works, so then I put a Combox(linked to the codes), a Textbox(for the
Qty) & Commandbutton with the code:
Public Sub QtyEnter1()
Range("A1") = ComboBox1.Value
Range("B1") = TextBox2.Value * 1
Call QtyEnter
End Sub

Which also works, so I tried combining the two:
Public Sub QtyEnter2()
Dim ThisCode, CodeRange As Range
Set ThisCode = ComboBox1.Value
lastrow = Sheets("Sheet1").Range("A65536").End(xlUp).Row
Set CodeRange = Range("a4:a" & lastrow)
For Each c In CodeRange
If c.Value = ThisCode.Value Then
c.Offset(0, 1) = TextBox2.Value * 1
End If
Next
End Sub

Which doesnt work (Object required at Set Thiscode) I know I Should be
Dimming ThisCode as something but nothing seems to work.
Help please!!

Many thanks
Paul

 
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
another combobox question teepee Excel Programming 2 May 13th 07 01:01 AM
combobox question Bri[_3_] Excel Programming 0 February 18th 06 02:51 PM
Combobox question lc Excel Programming 4 September 6th 05 03:40 PM
Combobox Question Andy Excel Programming 2 July 26th 05 04:52 PM
combobox question JT[_2_] Excel Programming 2 February 15th 05 04:32 PM


All times are GMT +1. The time now is 11:14 PM.

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"