+ Reply to Thread
Results 1 to 20 of 20

how to set select case values from sheet 2 vba code

  1. #1
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    how to set select case values from sheet 2 vba code

    hi all
    i have some code if any cell in column n has 133 entered it will pop up msgbox every time until 10 cells in column n are fill with 133 with can be offset by column f so if value 2 is enter then 133 message will only pop up 8 times i would like case value to be enter (133) on sheet2 a2 but would also like to set the lngCounter by cell b2 and if a value is enter in column f sheet 1 then take that way from b2 sheet 2 with in the code

    i have mark some of code i would like to change
    thanks for you help in advance

    Please Login or Register  to view this content.

    here a wookbook to test vba code.xlsm
    Last edited by sspreyer; 08-26-2013 at 02:40 PM.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: how to set select case values from sheet 2 vba code

    Please Login or Register  to view this content.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    Re: how to set select case values from sheet 2 vba code

    you are a total legend mate it works but one more question is there away i can put it in the code if column f has value added in a cell that it takes the value away from b2 if 133 and b3 if 122 b4 if 111. For example if i put 133 in n4 and put 133 in a2 sheet2 and i put 10 in b2 sheet 2 i will get the msgbox 10 times
    but if i put value 2 in column f say f4 i would like it to take it away from b2 sheet 2

    thanks

    shane

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: how to set select case values from sheet 2 vba code

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    Re: how to set select case values from sheet 2 vba code

    hi thanks sorry but this does seem to be working if i add 133 to a cell n4 and 133 in sheet 2 cell a2 and 10 in cell b2 sheet 2 and then i add 2 in to f4 sheet 1 it doesnt take the value from b2 sheet 2 the cell should change to 8 thank you i no im being a pain

    cheers

    shane

  6. #6
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    Re: how to set select case values from sheet 2 vba code

    hi
    Solus here a test work book showing what im trying to think it explains it better cheers again
    test code 4.xlsm
    shane

  7. #7
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    Re: how to set select case values from sheet 2 vba code

    some how i need to add
    Please Login or Register  to view this content.
    to this line of code
    Please Login or Register  to view this content.
    would be grapeful with any help

    this so if 133 is enter in any cell in column n and a value in column f is added then it takes it way from the ingcounter but i would like to take it away for worksheet 2 cell b2 aswell
    please help
    as this is my last pieces of vba project

  8. #8
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    Re: how to set select case values from sheet 2 vba code

    some how i need to add
    Please Login or Register  to view this content.
    to this line of code
    Please Login or Register  to view this content.
    would be grapeful with any help

    this so if 133 is enter in any cell in column n and a value in column f is added then it takes it way from the ingcounter but i would like to take it away for worksheet 2 cell b2 aswell
    please help
    as this is my last pieces of vba project
    thanks in advance

    ps. for administrator or moderator
    i'm not try to duplicate posts but i keep get error saying do not have permission when submit my post so then i do it again then it posts then i see i have done it twice
    Last edited by sspreyer; 08-26-2013 at 07:07 PM.

  9. #9
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    Re: how to set select case values from sheet 2 vba code

    bump up the list

  10. #10
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: how to set select case values from sheet 2 vba code

    What row in F do want to look for the number to subtract? The last row?

  11. #11
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    Re: how to set select case values from sheet 2 vba code

    I would like it to look at same row that has 133 in it and takeaway the value enter in column f from b2 sheet 2
    For example if column n has 133 and sheet b2 has value 10 in it and I put 2 in column f sheet 1 it will take it away from b2 value so then b2 will be 8 and then will only show 8 msgbox not 10 msgbox

    Sorry for being a pain really thankful for your help


    Shane

  12. #12
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: how to set select case values from sheet 2 vba code

    Please Login or Register  to view this content.

  13. #13
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: how to set select case values from sheet 2 vba code

    Hi, Shane,

    you should step back and think about your problem before posting multiple times as you discover something new to happen. This is the third thread (at least) about the very same basic problem, and I could have given you the code on the first try if you would have thought about that then.

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  14. #14
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    Re: how to set select case values from sheet 2 vba code

    you right Holger i just got abit carried away on what im try to get from the code sorry guys

    The code you posted still does not subract the value enter in column f from sheet2 ingcounter value(b2) if i enter 133 in column n and put 2 in column f same row if i then look at orignal value of b2 in sheet2 the "ingcounter" i set at 10 i would like column f to subtract 2 from incounter vaule in cell b2 sheet 2 and should show 8 not 10 doesnt seem to be working

    thanks for help and time guys

  15. #15
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: how to set select case values from sheet 2 vba code

    Hi, Shane,

    and why did you want a formula prior to that?

    Please Login or Register  to view this content.
    Ciao,
    Holger

  16. #16
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    Re: how to set select case values from sheet 2 vba code

    holger

    i'm using the code for stores order workbook so a person can enter item number then it check asset area before order a new item for example when user enter value in f Qty of item and then enter item number in Column n it will tell them how many are in the asset area instead of ordering a new one

    im still have issues with code if enter 10 in b2 sheet 2 then put 133 in column n it will take one away from b2 and show msgbox 9 remaining which is right but if i go next row down and put 133 in column n msgbox will say 7 remaining when should be 8 remaining and then sheet 2 b2 value changes to 7 when it should be 8

    the code is very close to perfect thanks holger you are legend

    shane
    Last edited by sspreyer; 08-27-2013 at 01:51 PM.

  17. #17
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: how to set select case values from sheet 2 vba code

    Hi, Shane,

    maybe itīs just
    Please Login or Register  to view this content.
    Ciao,
    Holger

  18. #18
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    Re: how to set select case values from sheet 2 vba code

    hi Holger
    work better but if enter 133 in 5 rows message box pop up correctly but then when i get to 6 row and type 133 no message pop up even tho there is still 4 remaining in b2 sheet 2 say 4 remaining which is correct but the messages stops. its as if the code is counting every entry for 2 so 10 becomes 5 the last message box pops up before it stop working has got the correct count tho

    thanks again

    shane

  19. #19
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: how to set select case values from sheet 2 vba code

    Hi, Shane,

    you may find the solution by yourself when you set a break point at the Select Case and single step with F8 through the code.

    Please comment the lines
    Please Login or Register  to view this content.
    and test again.

    If the value of 133 should be in for 10 times and has been filled in 5 times cell B2 shows 5 - and when checking the code goes Exit Sub.

    Ciao,
    Holger

  20. #20
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    Re: how to set select case values from sheet 2 vba code

    Thanks Lot i have finally got it to work i have ended up use a formula on work sheet to adjust counter value on the sheet2 and the vba code is adjusting the ingcounter so now the message box "show how many times " ties up with value on sheet 2

    thanks alot guys for your help specially you holger -----legend-----
    shane

    here code so you can see

    Please Login or Register  to view this content.

+ 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. Slow Case Select code
    By Kranky in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-06-2013, 05:57 PM
  2. [SOLVED] Disregard case in VBA code. (UCase, LCase, Select Case)
    By Orestees in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-07-2012, 12:12 PM
  3. Select Case code not returning correct statement
    By BCITgirl in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-19-2010, 01:15 AM
  4. Select Case: Formatting the code properly
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-09-2010, 11:46 AM
  5. [SOLVED] Simplify Code - Select Case
    By Edgar Thoemmes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2005, 10:06 PM

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