+ Reply to Thread
Results 1 to 2 of 2

Auto populate cells

  1. #1
    Registered User
    Join Date
    10-16-2012
    Location
    Bulgaria
    MS-Off Ver
    Excel 2010
    Posts
    1

    Auto populate cells

    Hey guys, I need some help on a simple task. It is about a roulette system. I want to enter the winning number (1-36) in A3 cell, and automatically populate A1 with "red" or "black", and A2 with "pair" or "impair", like

    ActiveSheet.Cells(i, 1).Value = "red"

    But I cannot handle the FOR and IF parts. Also, will the cells be populated as soon as I enter a number and hit "enter"?
    I will appreciate any help, Thank You.

  2. #2
    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,198

    Re: Auto populate cells

    Hi, burkoff,

    you could create a lookup table for that and use WorksheetFunction.VLookup to get the results.

    If you want to do it in code IŽd go with a Select Case to get out which numbers should show which color. For Pair you could utilize WorksheetFunctio.IsEven.

    Start with the Worksheet_Change-event right behind the sheet and limit that to just the cell where you want to enter:

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Last edited by HaHoBe; 10-16-2012 at 02:57 PM. Reason: Code amendment
    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

+ 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