Question

Create a sub in excel vba called "RandomColors" that assigns colors in a random way to...

Create a sub in excel vba called "RandomColors" that assigns colors in a random way to each cell of the range d4:h8. (hint:set the colorindex property of each cell in the range to a random integer between 1 and 10)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer :

Sub RandomColors()
Dim value as Integer
Randomise ' Initialize random-number generator.

' Generate random value between 1 and 10.
' The default color palette has 10 colors.
value = Int((10 * Rnd) + 1)

Range("D4:H8").Interior.ColorIndex = value


End Sub

Add a comment
Know the answer?
Add Answer to:
Create a sub in excel vba called "RandomColors" that assigns colors in a random way to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Open up a clean Module and complete the coding of Module in VBA. Do the following tasks 1. Create a “main” sub, and assign the sub to the “Start” button on the worksheet. 2. Write the “clearOutput”...

    Open up a clean Module and complete the coding of Module in VBA. Do the following tasks 1. Create a “main” sub, and assign the sub to the “Start” button on the worksheet. 2. Write the “clearOutput” sub. Also, assign this sub to the “Reset” button. In this sub, you will clear the content of range (B3:D5), (B9:B11), and (D14:D15) on the worksheet “RP”. 3. Write the “loadData” sub. The data is stored in the worksheet “HR”. Name the data...

  • Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it...

    Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it to a size equal to an assigned value of a variable, populate the array with a series of random numbers, output the array to a message box and to a worksheet. Instructions: - Review the variables already declared. You won't need others. - See comments in the code that will act as your guide. Add new code directly after each comment. - Assign a...

  • I need this problem to be solved in Excel VBA code. Need full code in VBA....

    I need this problem to be solved in Excel VBA code. Need full code in VBA. Please solve 1st Task : '5 or 0'. Please help me urgently with proper answer and coding solutions which I can run in Excel/vba. Thanks Course: Programming languages Second laboratory work File and string processing Create a program that processes text file according to task variant. Requirements: 1. Create text file (use notepad) with some lines of data according to task variant. 2. Ask...

  • I need some VBA(excel) help. This is what I was given: 'Review the attached data on...

    I need some VBA(excel) help. This is what I was given: 'Review the attached data on the 'Data worksheet'. The data represents the Sales Tax information for the 50-city States in US. 'Create two functions that computes the following for each state: 'StateTax: ListedPrice * State Tax Rate 'Local Tax Rate: ListedPrice * Local Tax rate 'Determine Sales Amount as: ListedPrice + StateTax + LocalTax 'TotalTax as StateTax + LocalTax 'DiscountOpportunity as: MINIMUM(ListPrice * 2%, SalesTax * 1.5%) These are...

  • the macro must be done through VBA (visual basic aid) on excel. thank you 1 Create...

    the macro must be done through VBA (visual basic aid) on excel. thank you 1 Create a macro to extract all of the data from the year 2015 and copy it into a separate block. 2 create a table that displays the minimum concentration for each month in the copyed data. 3 Add a button to run the macro. 5 Date Concentration (mcg/I) 6 2/21/2015 79/2/2015 8 1/17/2015 9 4/30/2015 01/1/2016 11 10/31/2015 12 8/26/2016 13 12/6/2016 14 5/19/2015 15...

  • 5.4 Java Create a program that generates SuperLotto lottery numbers. Create a class called SuperLottoPlus.java Create...

    5.4 Java Create a program that generates SuperLotto lottery numbers. Create a class called SuperLottoPlus.java Create a method called generateSuperLottoNumbers() that returns an array of 6 random SuperLotto lottery numbers. The first 5 numbers must be from the range 1 to 47 The 6th number (the MEGA) must be from 1 to 27. Create a method called printTicket() that takes an integer array as an parameter it will loop through the integer array and print out the data Display the...

  • C++ Program Int Main First Please Write one program that does the following: 1.       1.   Ask the...

    C++ Program Int Main First Please Write one program that does the following: 1.       1.   Ask the user for ten (10) grades, and store the data in an array.  Compute the average of all the grades.  Print the original ten grades and the average. a.       Declare an integer array with the name of “grades” of size 10 in the main function. b.      Create a function called “getGrades” that prompts the User for the grades and puts them in an integer array.                                                                i.      The function will receive...

  • Write VBA functions to calculate sin (x) using the Maclaurin arcsine series, and compare the values...

    Write VBA functions to calculate sin (x) using the Maclaurin arcsine series, and compare the values for sin-1(x) from your program to those given by the Excel spreadsheet function ASIN(x). The Maclaurin arcsine expansion is given by x 3x 6 40 (2n)! sin1(x)-2((2n+1) Note: This function by definition is only defined for-1 SxS1. When you write the code for calculating it, you will need to include code that assigns a value to it that reflects it is undefined for values...

  • matlab please Problem 1. PART A Create a cell array called ca that will contain the following: [Physics] [14][1 4 -...

    matlab please Problem 1. PART A Create a cell array called ca that will contain the following: [Physics] [14][1 4 -3 8] [ITim] [Burnett]] [23] [Jessica] [Wul] [3 9 17] [Chemistry] [8 7 2 91 [Literature] [IJavier] [Lopez] [54] As shown above, the cell array ca should contain within the cells of each row: a department name (eg. Physics), integer code (e.g., 14), an array of integers (e.g., [1 4-3 8]), and two sub-cells containing a person's first and last...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT