Input box to count rows and highlight vba code

Goalexcel

Board Regular
Joined
Dec 28, 2020
Messages
101
Office Version
  1. 2016
Platform
  1. Windows
Hello Experts, kindly help to use a vba code for the below.

image1.png


Use inputbox to select from column A first 14 rows and color, next amount of rows follow the image above. Do the same on other sheets.
The result below
image2.png
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hello Experts, kindly help to use a vba code for the below.

View attachment 50857

Use inputbox to select from column A first 14 rows and color, next amount of rows follow the image above. Do the same on other sheets.
The result below
View attachment 50858
The image does not help me.
In your example first 14 cells in column A are Yellow I can see that in your image
But second 14 cells are green. But I do not see light green in image. And we can not have a script look at a image to know what to do.
Would you please add more specifics. Thanks`
 
Upvote 0
The image does not help me.
In your example first 14 cells in column A are Yellow I can see that in your image
But second 14 cells are green. But I do not see light green in image. And we can not have a script look at a image to know what to do.
Would you please add more specifics. Thanks`
With inputbox help to select 14 rows and format color yellow (follow the first image), after continue with color 14 rows blue, to apply in column A
start row 1 until row 145, with first image use the amount of number and color. Thank you.
 
Upvote 0
Sure we can write the script by looking at a image. So we have to write the script looking at a image but that means we have to write each line of code one by one.
What you should do is put the numbers and cell colors in column B stating at row 1
Now a script can use the value in range("B1") and the color in Range("B1") to to make your script.
And so on into Range("B2") B3 B4 etc. Doing this we would only have to write maybe 5 lines of code. Doing it your way would require may 600 lines of code.
 
Upvote 0
Sure we can write the script by looking at a image. So we have to write the script looking at a image but that means we have to write each line of code one by one.
What you should do is put the numbers and cell colors in column B stating at row 1
Now a script can use the value in range("B1") and the color in Range("B1") to to make your script.
And so on into Range("B2") B3 B4 etc. Doing this we would only have to write maybe 5 lines of code. Doing it your way would require may 600 lines of code.
My apologies, you are the Expert!!!. Thank you for your attention.
 
Upvote 0
If you put the data in your image into column B
The cell colors and the numbers like 5
You can use this script.
Be sure and put the numbers and color the cells the way you want
Do not put your image in column B

VBA Code:
Sub Color_My_Cells()
'Modified 11/10/2021  10:30:01 PM  EST
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Dim Lastrowa As Long
Lastrowa = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To Lastrowa
Cells(Lastrow, 1).Resize(Cells(i, 2).Value) = Cells(i, 2).Value
Cells(Lastrow, 1).Resize(Cells(i, 2)).Interior.Color = Cells(i, 2).Interior.Color
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Not sure what is happening here. Do you now have a answer that works?
When run macro, the number and color go to the last of my original data..
1636603769686.png


We need Color and count 14 rows from the first row A1. We almost near!!!!
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top