Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Graying Out Some Rows
Hi,
I never did Excel programming before, but I do VB programming. I have a spreadsheet with many rows and columns, to make it more easy to read the data in each row, I was wondering if there is a way to program the spreadsheet the way that every other row is grayed out. Please help and please tell me how to access Excel modules to type in the code. Thanks a million. Tamer |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Graying Out Some Rows
Tamer,
Do the following: 1) Press ALT+F11 to open the VBA Editor. 2) There, go to the Insert menu and choose module. 3) In the Module, paste the following code Sub ColorRows() Dim RowNdx As Long For RowNdx = 1 To ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastC ell).Row _ Step 2 Rows(RowNdx).Interior.ColorIndex = 15 Next RowNdx End Sub 4) Flip back to Excel 5) Pres ALT+F8 to display the Macro dialog 6) Choose ColorRows and click Run. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tamer Seoud" wrote in message ... Hi, I never did Excel programming before, but I do VB programming. I have a spreadsheet with many rows and columns, to make it more easy to read the data in each row, I was wondering if there is a way to program the spreadsheet the way that every other row is grayed out. Please help and please tell me how to access Excel modules to type in the code. Thanks a million. Tamer |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Graying Out Some Rows
You can do this with conditional formatting
formatconditional formatttingcond 1select formula istype in =mod(row(),2)=0 and format as desiredcopy to other cells or select cells first -- Don Guillett SalesAid Software "Tamer Seoud" wrote in message ... Hi, I never did Excel programming before, but I do VB programming. I have a spreadsheet with many rows and columns, to make it more easy to read the data in each row, I was wondering if there is a way to program the spreadsheet the way that every other row is grayed out. Please help and please tell me how to access Excel modules to type in the code. Thanks a million. Tamer |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Graying Out Some Rows
Chip,
Thanks for your reply. I tried what you told me but I get an error message "Syntax Error". Am I supposed to paste the exact code you sent me or I have to change something on it? And What is the "_" in the code between the first part and Step 2? It seems there is a problem with the "_". Please advise. Thanks again for your help. Tamer -----Original Message----- Tamer, Do the following: 1) Press ALT+F11 to open the VBA Editor. 2) There, go to the Insert menu and choose module. 3) In the Module, paste the following code Sub ColorRows() Dim RowNdx As Long For RowNdx = 1 To ActiveSheet.UsedRange.SpecialCells (xlCellTypeLastCell).Row _ Step 2 Rows(RowNdx).Interior.ColorIndex = 15 Next RowNdx End Sub 4) Flip back to Excel 5) Pres ALT+F8 to display the Macro dialog 6) Choose ColorRows and click Run. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tamer Seoud" wrote in message ... Hi, I never did Excel programming before, but I do VB programming. I have a spreadsheet with many rows and columns, to make it more easy to read the data in each row, I was wondering if there is a way to program the spreadsheet the way that every other row is grayed out. Please help and please tell me how to access Excel modules to type in the code. Thanks a million. Tamer . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Graying Out Some Rows
Tamer,
The lines got split in the posted message. Try For RowNdx = 1 To ActiveSheet.UsedRange.SpecialCells _ (xlCellTypeLastCell).Row Step 2 The " _" character is a line continuation character that lets you write one logical line of code on two actual lines of text. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tamer Seoud" wrote in message ... Chip, Thanks for your reply. I tried what you told me but I get an error message "Syntax Error". Am I supposed to paste the exact code you sent me or I have to change something on it? And What is the "_" in the code between the first part and Step 2? It seems there is a problem with the "_". Please advise. Thanks again for your help. Tamer -----Original Message----- Tamer, Do the following: 1) Press ALT+F11 to open the VBA Editor. 2) There, go to the Insert menu and choose module. 3) In the Module, paste the following code Sub ColorRows() Dim RowNdx As Long For RowNdx = 1 To ActiveSheet.UsedRange.SpecialCells (xlCellTypeLastCell).Row _ Step 2 Rows(RowNdx).Interior.ColorIndex = 15 Next RowNdx End Sub 4) Flip back to Excel 5) Pres ALT+F8 to display the Macro dialog 6) Choose ColorRows and click Run. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tamer Seoud" wrote in message ... Hi, I never did Excel programming before, but I do VB programming. I have a spreadsheet with many rows and columns, to make it more easy to read the data in each row, I was wondering if there is a way to program the spreadsheet the way that every other row is grayed out. Please help and please tell me how to access Excel modules to type in the code. Thanks a million. Tamer . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Graying Out Some Rows
Chip,
You're the man. It worked. Thank you so much. -----Original Message----- Tamer, The lines got split in the posted message. Try For RowNdx = 1 To ActiveSheet.UsedRange.SpecialCells _ (xlCellTypeLastCell).Row Step 2 The " _" character is a line continuation character that lets you write one logical line of code on two actual lines of text. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tamer Seoud" wrote in message ... Chip, Thanks for your reply. I tried what you told me but I get an error message "Syntax Error". Am I supposed to paste the exact code you sent me or I have to change something on it? And What is the "_" in the code between the first part and Step 2? It seems there is a problem with the "_". Please advise. Thanks again for your help. Tamer -----Original Message----- Tamer, Do the following: 1) Press ALT+F11 to open the VBA Editor. 2) There, go to the Insert menu and choose module. 3) In the Module, paste the following code Sub ColorRows() Dim RowNdx As Long For RowNdx = 1 To ActiveSheet.UsedRange.SpecialCells (xlCellTypeLastCell).Row _ Step 2 Rows(RowNdx).Interior.ColorIndex = 15 Next RowNdx End Sub 4) Flip back to Excel 5) Pres ALT+F8 to display the Macro dialog 6) Choose ColorRows and click Run. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tamer Seoud" wrote in message ... Hi, I never did Excel programming before, but I do VB programming. I have a spreadsheet with many rows and columns, to make it more easy to read the data in each row, I was wondering if there is a way to program the spreadsheet the way that every other row is grayed out. Please help and please tell me how to access Excel modules to type in the code. Thanks a million. Tamer . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Enabling option „Format rows“ to hide/unhide rows using VBA-code? | Excel Discussion (Misc queries) | |||
Counting characters in multiple rows when rows meet specific criteria | Excel Worksheet Functions | |||
Copy rows of data (eliminating blank rows) from fixed layout | Excel Discussion (Misc queries) | |||
Excel 2003 -Rows hidden. Scrolling unhides rows ! How do I stop th | Excel Discussion (Misc queries) | |||
Charts graying out | Charts and Charting in Excel |