Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Repost Of ealier Question

Hi all I had asked this before but I dont think I was very clear so I will
try to explain this better.

I have a userform where I have a combobox1 which it rowsource is ranges
a1:c:1000
I also have 2 textbox's

textbox1 and textbox2

I want to have a macro look up the value of combobox1 and then compare it
with sheet "reg". Once it has found the item I want the value of textbox1
to automatically add on to the value in that cell which is in column "e" and
the same with textbox2 with column"f".

Bob tried to help with this code below but it does not seem to work.
Set rng = Worksheets("Sheet1").Range("A1:A10")
On Error Resume Next
iPos = Application.Vlookup(Listbox1.Value)
On Error GoTo 0
If iPos 0 Then
Worksheets("Sheet1").Cells(iPos, "E").Value = _
Worksheets("Sheet1").Cells(iPos, "E").Value TextBox1.Text
Worksheets("Sheet1").Cells(iPos, "F").Value = _
Worksheets("Sheet1").Cells(iPos, "F").Value Textbox2.Text
End If

Thanks

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Repost Of ealier Question

Greg,

Couple of errors in the code. Try this

Set rng = Worksheets("Sheet1").Range("A1:A10")
On Error Resume Next
iPos = Application.Match(ListBox1.Value, rng, 0)
On Error GoTo 0
If iPos 0 Then
Worksheets("Sheet1").Cells(iPos, "E").Value = _
Worksheets("Sheet1").Cells(iPos, "E").Value + TextBox1.Text
Worksheets("Sheet1").Cells(iPos, "F").Value = _
Worksheets("Sheet1").Cells(iPos, "F").Value + TextBox2.Text
End If



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Greg B" wrote in message
...
Hi all I had asked this before but I dont think I was very clear so I will
try to explain this better.

I have a userform where I have a combobox1 which it rowsource is ranges
a1:c:1000
I also have 2 textbox's

textbox1 and textbox2

I want to have a macro look up the value of combobox1 and then compare it
with sheet "reg". Once it has found the item I want the value of textbox1
to automatically add on to the value in that cell which is in column "e"

and
the same with textbox2 with column"f".

Bob tried to help with this code below but it does not seem to work.
Set rng = Worksheets("Sheet1").Range("A1:A10")
On Error Resume Next
iPos = Application.Vlookup(Listbox1.Value)
On Error GoTo 0
If iPos 0 Then
Worksheets("Sheet1").Cells(iPos, "E").Value = _
Worksheets("Sheet1").Cells(iPos, "E").Value TextBox1.Text
Worksheets("Sheet1").Cells(iPos, "F").Value = _
Worksheets("Sheet1").Cells(iPos, "F").Value Textbox2.Text
End If

Thanks

Greg




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Repost Of ealier Question

it doesn't seem to work must be a problem on my end. I will work on it and
try it again later. The macro doesnt change the numbers in the cell.

Thanks

Greg
"Bob Phillips" wrote in message
...
Greg,

Couple of errors in the code. Try this

Set rng = Worksheets("Sheet1").Range("A1:A10")
On Error Resume Next
iPos = Application.Match(ListBox1.Value, rng, 0)
On Error GoTo 0
If iPos 0 Then
Worksheets("Sheet1").Cells(iPos, "E").Value = _
Worksheets("Sheet1").Cells(iPos, "E").Value + TextBox1.Text
Worksheets("Sheet1").Cells(iPos, "F").Value = _
Worksheets("Sheet1").Cells(iPos, "F").Value + TextBox2.Text
End If



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Greg B" wrote in message
...
Hi all I had asked this before but I dont think I was very clear so I
will
try to explain this better.

I have a userform where I have a combobox1 which it rowsource is ranges
a1:c:1000
I also have 2 textbox's

textbox1 and textbox2

I want to have a macro look up the value of combobox1 and then compare it
with sheet "reg". Once it has found the item I want the value of
textbox1
to automatically add on to the value in that cell which is in column "e"

and
the same with textbox2 with column"f".

Bob tried to help with this code below but it does not seem to work.
Set rng = Worksheets("Sheet1").Range("A1:A10")
On Error Resume Next
iPos = Application.Vlookup(Listbox1.Value)
On Error GoTo 0
If iPos 0 Then
Worksheets("Sheet1").Cells(iPos, "E").Value = _
Worksheets("Sheet1").Cells(iPos, "E").Value TextBox1.Text
Worksheets("Sheet1").Cells(iPos, "F").Value = _
Worksheets("Sheet1").Cells(iPos, "F").Value Textbox2.Text
End If

Thanks

Greg






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Repost Of ealier Question

Greg,

It is doing so for me.

One thing, I am doing a match on cells A1:A10, is that the correct range?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Greg B" wrote in message
...
it doesn't seem to work must be a problem on my end. I will work on it

and
try it again later. The macro doesnt change the numbers in the cell.

Thanks

Greg
"Bob Phillips" wrote in message
...
Greg,

Couple of errors in the code. Try this

Set rng = Worksheets("Sheet1").Range("A1:A10")
On Error Resume Next
iPos = Application.Match(ListBox1.Value, rng, 0)
On Error GoTo 0
If iPos 0 Then
Worksheets("Sheet1").Cells(iPos, "E").Value = _
Worksheets("Sheet1").Cells(iPos, "E").Value + TextBox1.Text
Worksheets("Sheet1").Cells(iPos, "F").Value = _
Worksheets("Sheet1").Cells(iPos, "F").Value + TextBox2.Text
End If



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Greg B" wrote in message
...
Hi all I had asked this before but I dont think I was very clear so I
will
try to explain this better.

I have a userform where I have a combobox1 which it rowsource is ranges
a1:c:1000
I also have 2 textbox's

textbox1 and textbox2

I want to have a macro look up the value of combobox1 and then compare

it
with sheet "reg". Once it has found the item I want the value of
textbox1
to automatically add on to the value in that cell which is in column

"e"
and
the same with textbox2 with column"f".

Bob tried to help with this code below but it does not seem to work.
Set rng = Worksheets("Sheet1").Range("A1:A10")
On Error Resume Next
iPos = Application.Vlookup(Listbox1.Value)
On Error GoTo 0
If iPos 0 Then
Worksheets("Sheet1").Cells(iPos, "E").Value = _
Worksheets("Sheet1").Cells(iPos, "E").Value TextBox1.Text
Worksheets("Sheet1").Cells(iPos, "F").Value = _
Worksheets("Sheet1").Cells(iPos, "F").Value Textbox2.Text
End If

Thanks

Greg








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Repost Of ealier Question

Thanks for that it was that problem exactly.
thanks

Greg

"Bob Phillips" wrote in message
...
Greg,

It is doing so for me.

One thing, I am doing a match on cells A1:A10, is that the correct range?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Greg B" wrote in message
...
it doesn't seem to work must be a problem on my end. I will work on it

and
try it again later. The macro doesnt change the numbers in the cell.

Thanks

Greg
"Bob Phillips" wrote in message
...
Greg,

Couple of errors in the code. Try this

Set rng = Worksheets("Sheet1").Range("A1:A10")
On Error Resume Next
iPos = Application.Match(ListBox1.Value, rng, 0)
On Error GoTo 0
If iPos 0 Then
Worksheets("Sheet1").Cells(iPos, "E").Value = _
Worksheets("Sheet1").Cells(iPos, "E").Value + TextBox1.Text
Worksheets("Sheet1").Cells(iPos, "F").Value = _
Worksheets("Sheet1").Cells(iPos, "F").Value + TextBox2.Text
End If



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Greg B" wrote in message
...
Hi all I had asked this before but I dont think I was very clear so I
will
try to explain this better.

I have a userform where I have a combobox1 which it rowsource is
ranges
a1:c:1000
I also have 2 textbox's

textbox1 and textbox2

I want to have a macro look up the value of combobox1 and then compare

it
with sheet "reg". Once it has found the item I want the value of
textbox1
to automatically add on to the value in that cell which is in column

"e"
and
the same with textbox2 with column"f".

Bob tried to help with this code below but it does not seem to work.
Set rng = Worksheets("Sheet1").Range("A1:A10")
On Error Resume Next
iPos = Application.Vlookup(Listbox1.Value)
On Error GoTo 0
If iPos 0 Then
Worksheets("Sheet1").Cells(iPos, "E").Value = _
Worksheets("Sheet1").Cells(iPos, "E").Value TextBox1.Text
Worksheets("Sheet1").Cells(iPos, "F").Value = _
Worksheets("Sheet1").Cells(iPos, "F").Value Textbox2.Text
End If

Thanks

Greg










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
Parameter question on query in Excel (Repost) Leanne M (Aussie) Excel Discussion (Misc queries) 0 April 29th 08 10:12 AM
Repost of VBA Code/Lookup question Steve_n_KC Excel Worksheet Functions 5 June 23rd 07 01:34 AM
Question - Repost Brandon[_8_] Excel Programming 2 September 9th 05 08:42 PM
Data Validation Boxes and Ealier Versions of Excel ExcelMonkey[_155_] Excel Programming 2 July 28th 04 02:23 PM
Excel 2000 math question, repost Bob Phillips[_5_] Excel Programming 5 November 9th 03 11:51 PM


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