Welcome Guest
Log In | Register )
You last visited December 9, 2016, 4:13 pm
All times shown are
Eastern Time (GMT-5:00)

Anyone proficient with VB 6.0?

Topic closed. 7 replies. Last post 10 years ago by SirMetro.

Page 1 of 1
PrintE-mailLink
Snakeyes's avatar - 8579390479 65f71643cf_m.jpg
Cleveland, Ohio
United States
Member #11445
February 13, 2005
1303 Posts
Offline
Posted: August 14, 2006, 11:04 am - IP Logged

I'm trying something with Excel and VB and am trying to understand conditional coding. I'm a newb and know only enough to be dangerous. Anyone here in LP that can help me with a code issue would be greatly appreciated. Send me a PM and I'll give you the details.

 

Thanks,

Snakeyes

    Todd's avatar - Cylon 2.gif
    Chief Bottle Washer
    New Jersey
    United States
    Member #1
    May 31, 2000
    23274 Posts
    Offline
    Posted: August 14, 2006, 2:33 pm - IP Logged

    I would be happy to help, but unless it's a sensitive matter, I would prefer to do it on the public forums so others could benefit.

     

    Check the State Lottery Report Card
    What grade did your lottery earn?

     

    Sign the Petition for True Lottery Drawings
    Help eliminate computerized drawings!

      Snakeyes's avatar - 8579390479 65f71643cf_m.jpg
      Cleveland, Ohio
      United States
      Member #11445
      February 13, 2005
      1303 Posts
      Offline
      Posted: August 14, 2006, 2:45 pm - IP Logged

      Todd,

      Thanks for offering. Paurth's helped me out earlier today; sorry for not updating this post.

      No, not a sensitive matter in the least. It just was not lottery oriented and I didn't want to polute the intent of the forums too much. However, to offer up my problem and the solution (Thank you Paurths!), as simple as it may be to others (but difficult for me since it is all greek in my mind):

      Private Sub CheckBox3_Click()

          ActiveSheet.Unprotect Password:="test"

          If CheckBox3 Then

            Range("c47").Value = 0.1

            Range("d62").Value = 0.04

         

          Else

            Range("c47").Value = 0

            Range("d62").Value = 0.02

           

          End If

          ActiveSheet.Protect Password:="test"

      End Sub

       

      After a few days, I was able to produce the above. I still wanted to be able to go to another cell in Excel and have it change the value of c47 to .085 if the value of the other cell was above 500.

       

      This was the solution:

      If CheckBox3 Then
         
              If CInt(Range("j3")) > 500 Then
         
                  Range("c47").Value = 0.085
                  Range("d62").Value = 0.04
             
              Else

                  Range("c47").Value = 0.1
                  Range("d62").Value = 0.04
             
              End If

          Else
              Range("c47").Value = 0
              Range("d62").Value = 0.02
           
          End If

       

      Anyway, the above is probably very basic stuff to a programmer but like learning a new language to us non-programming guys.

       

      Thanks for offering Todd; it's appreciated.

      Snakeyes

        Todd's avatar - Cylon 2.gif
        Chief Bottle Washer
        New Jersey
        United States
        Member #1
        May 31, 2000
        23274 Posts
        Offline
        Posted: August 14, 2006, 3:17 pm - IP Logged

        Thanks for posting your code and solution!

        You (and anyone else) have a standing offer from me -- if you need help with VB code, I will be happy to help, as I'm sure other VB programmers like paurths would be as well.  I think any of this stuff is very relevant to lotteries in general, since many people use programs to help determine what numbers to play.

         

        Check the State Lottery Report Card
        What grade did your lottery earn?

         

        Sign the Petition for True Lottery Drawings
        Help eliminate computerized drawings!

          Snakeyes's avatar - 8579390479 65f71643cf_m.jpg
          Cleveland, Ohio
          United States
          Member #11445
          February 13, 2005
          1303 Posts
          Offline
          Posted: August 14, 2006, 3:26 pm - IP Logged

          Thanks, I'll will take you up on your offer the next time I need help.

           

          Next up (see how quick that was? LOL!)  is trying to figure out how to get asp.net forums to work on my rc club site. I have it installed on my server but cannot get it to work properly. Something with administrative issues. If you know aspnet forums, I'll take the time to send you info on the issue.

           

          Thanks again!

          Snakeyes

            Todd's avatar - Cylon 2.gif
            Chief Bottle Washer
            New Jersey
            United States
            Member #1
            May 31, 2000
            23274 Posts
            Offline
            Posted: August 14, 2006, 5:13 pm - IP Logged

            I wasn't aware that ASP.NET forums were still being supported.  As far as I know it has not been updated for 2.0.  You may instead want to go with Community Server, which offers a free version.

             

            Check the State Lottery Report Card
            What grade did your lottery earn?

             

            Sign the Petition for True Lottery Drawings
            Help eliminate computerized drawings!

              Snakeyes's avatar - 8579390479 65f71643cf_m.jpg
              Cleveland, Ohio
              United States
              Member #11445
              February 13, 2005
              1303 Posts
              Offline
              Posted: August 15, 2006, 1:18 pm - IP Logged

              Thanks Todd. I've never heard of Community Server however, will be checking it out this evening.

               

              Thanks for the tip!

                SirMetro's avatar - center
                East of Atlanta
                United States
                Member #6191
                August 11, 2004
                1389 Posts
                Offline
                Posted: August 28, 2006, 6:23 pm - IP Logged

                Neat little trick that may help you out in what you are trying to accomplish.

                While in Excel, do an activity that could benefit you if it was a Macro (aka VB code).  Simply record the steps with the Macro Recorder turned on.

                Then when you are done, end the record session. Next, click Edit the Macro and take a peek at what it gives you.

                Keep in mind, it will literally record each and every step and keystroke you make.

                One other note, understand how to use the coordinate system instead of hard coding the cells. The coordinate system uses the x,y method and refers to cell A1 as 1,1

                This also makes it easy to do loops and for/next statements.

                Also, do a bit of research on the Select Case command. It works better then IF/THEN statements and has a higher limit of choices. I think If/Then stops at 7 whereas SelectCase can go into the hundreds. Just remember, keep the values in numerical order (smallest to largest).

                Now, I am no expert at programming or VB, I know just enough to get me out of binds and to keep me in trouble. Another cool source of info for VB and Excel is http://www.mrexcel.com/ 

                Although, I think they offer up a few services, the main forum is free to sign up and ask for help on.  I have gotten several bits of usuable code from there.

                So Good Luck and have fun.

                Sir Metro