+ Reply to Thread
Results 1 to 4 of 4

loop through a spreadsheet looking for the value from a userform combobox

  1. #1
    Registered User
    Join Date
    06-19-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    loop through a spreadsheet looking for the value from a userform combobox

    Hi Guys,

    I have set up a spreadsheet to record transactions and modify them.

    I have a few user forms to :
    - Create a new transaction
    - Extend the date
    - deliver a transaction
    - cancel a transaction.

    All of these basically create a new record (row) with the new/updated data for a given transaction.

    All rows start with the transaction reference (a number in column "A"). the transaction will keep that same number throughout.

    All the creation of new record works well. But before creating a new record for an existing transaction I want to modify all other records of that transaction and change their status to "closed" (the status is recorded in column "B"). I can then filter in a separate tab to only see the "open" transactions, which works well.

    I am basically trying to loop through the database (in spreadsheet "Blotter") looking for the reference of the transaction I am modifying (retrieved form a combobox in a userform) and update its status to "closed" (there may be several line items with the same reference but only one will have a status "Open") before I create a new record for that transaction with the status "open".

    This is the code I have on validation of a transaction modifying an existing deal (it then calls "populate" which creates the new record and works well).

    Please Login or Register  to view this content.
    For some reason the status is stubborn and does not want to change to "Closed"...

    Any help would be great...

    Thanks

    Alex

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: loop through a spreadsheet looking for the value from a userform combobox

    Hello alexmech,

    Welcome to the Forum!

    Try this version of your macro.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    06-19-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: loop through a spreadsheet looking for the value from a userform combobox

    Excellent!...

    I had to play with it a bit... I think there was a problem with the "capture" of the value from the Combobox, as your code initially didn't "close" the deal.
    It's a bit of a "Barbaric" method but this is what I have done :

    Please Login or Register  to view this content.
    So I "paste" the variable in the spreadsheet and compare it to the range... not very aesthetic but it works...

    Thanks for the help !

    Cheers,

    Alex

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: loop through a spreadsheet looking for the value from a userform combobox

    Hello Alex,

    Your approach is a reasonable one, certainly not barbaric. Glad I could help out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] send data from userform combobox to userform combobox
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-18-2013, 04:47 PM
  2. [SOLVED] VBA Userform ComboBox: Content of ComboBox based off of Conditional Statement
    By Brianandstewie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-16-2013, 03:00 PM
  3. [SOLVED] Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox select
    By MileHigh_PhD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 04:50 PM
  4. [SOLVED] Add RowSource to Userform ComboBox based on value on Another ComboBox
    By Baziwan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-10-2012, 01:17 PM
  5. UserForm TextBox and ComboBox selections populate SPECIFIC spreadsheet cells
    By ZIXILPLIX in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-23-2010, 02:45 AM

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