ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Highlighting a certain range of cells (https://www.excelbanter.com/excel-programming/408979-highlighting-certain-range-cells.html)

Stav19

Highlighting a certain range of cells
 
Hi All

I'm a beginner at using macros, and after playing around with
recording a bit, I came up with this something that enables me to copy
and paste values from one spreasheet to a new sheet, and highlight
certain cells. The problem is that going forward I don't want to have
to keep changing the macro (mainly as I'm not totally sure how!!!) if
the cells to be highlighted change. Is there any way around that? I
tried naming a range but didn't work, as the cells aren't all
following on from each other???

Sheets("Information").Select
Sheets.Add.Name = "Values"
Sheets("Information").Select
Range("Data_to_copy").Select
Selection.Copy
Sheets("Values").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Columns("A:B").EntireColumn.AutoFit
Application.CutCopyMode = False
Sheets("Values").Select
Range("A19:B19").Select
Range("A19:B19,A37:B40,A42:B47").Select
Range("A42").Activate
Range("A19:B19,A37:B40,A42:B47,A49:B52").Select
Range("A49").Activate

Range("A19:B19,A37:B40,A42:B47,A49:B52,A54:B58,A60 :B64,A66:B67,A69:B71,A73:B74"
_
).Select
Range("A73").Activate
ActiveWindow.SmallScroll Down:=23
Range( _

"A19:B19,A37:B40,A42:B47,A49:B52,A54:B58,A60:B64,A 66:B67,A69:B71,A73:B74,A76:B76,A78:B79,A81:B83"
_
).Select
Range("A81").Activate
With Selection.Interior
.ColorIndex = 8
.Pattern = xlSolid
End With
Selection.Font.Bold = True
Sheets("Information").Select
Range("B2").Select

Any help would be appreciated!!!

thanks


All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com