+ Reply to Thread
Results 1 to 5 of 5

Repost Of ealier Question

Hybrid View

  1. #1
    Bob Phillips
    Guest

    Re: 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" <tam71@ihug.com.au> wrote in message
    news:dupacf$fp7$1@lust.ihug.co.nz...
    > 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. #2
    Greg B
    Guest

    Re: 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" <bob.phillips@notheretiscali.co.uk> wrote in message
    news:en1xzB4QGHA.1416@TK2MSFTNGP12.phx.gbl...
    > 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" <tam71@ihug.com.au> wrote in message
    > news:dupacf$fp7$1@lust.ihug.co.nz...
    >> 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. #3
    Bob Phillips
    Guest

    Re: 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" <tam71@ihug.com.au> wrote in message
    news:dupcg2$jhl$1@lust.ihug.co.nz...
    > 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" <bob.phillips@notheretiscali.co.uk> wrote in message
    > news:en1xzB4QGHA.1416@TK2MSFTNGP12.phx.gbl...
    > > 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" <tam71@ihug.com.au> wrote in message
    > > news:dupacf$fp7$1@lust.ihug.co.nz...
    > >> 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. #4
    Greg B
    Guest

    Re: Repost Of ealier Question

    Thanks for that it was that problem exactly.
    thanks

    Greg

    "Bob Phillips" <bob.phillips@notheretiscali.co.uk> wrote in message
    news:es8HDb4QGHA.4608@tk2msftngp13.phx.gbl...
    > 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" <tam71@ihug.com.au> wrote in message
    > news:dupcg2$jhl$1@lust.ihug.co.nz...
    >> 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" <bob.phillips@notheretiscali.co.uk> wrote in message
    >> news:en1xzB4QGHA.1416@TK2MSFTNGP12.phx.gbl...
    >> > 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" <tam71@ihug.com.au> wrote in message
    >> > news:dupacf$fp7$1@lust.ihug.co.nz...
    >> >> 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1