Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie needs help
This is probably very easy to do, however I've got no clue as to wha I'm doing... Basically I need to program a macro to do the following... 1. Create a new Sheet in an Excel Workbook 2. Draw a grid from Cells A:1 to D:10 3. Format the grid with thick lined borders in Yellow 4. Colour each cell with alternate Red and green colours. Now I've made an effort and I've got 1 done (I think) Insert New WorkSheet Any help would be really appriciated as this is very important that actually complete this ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie needs help
You can use your macro recorder to get your code Mark
ToolsMacro..Record a New Macro Do the things you want and study the code -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "MarkJones" wrote in message ... This is probably very easy to do, however I've got no clue as to what I'm doing... Basically I need to program a macro to do the following... 1. Create a new Sheet in an Excel Workbook 2. Draw a grid from Cells A:1 to D:10 3. Format the grid with thick lined borders in Yellow 4. Colour each cell with alternate Red and green colours. Now I've made an effort and I've got 1 done (I think) Insert New WorkSheet Any help would be really appriciated as this is very important that I actually complete this. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie needs help
It is homework in a way, it's for a job application, the annoying thin is I'm actually supposed to be learning Excel as part of my training. even said to the guy doing the interview "I have never programme anything in Excel" Oh well, will do it the way you said, thanks ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie needs help
Mark,
Try something like the following: Dim R As Range Dim Rng As Range Dim WS As Worksheet Dim ColorRed As Boolean Dim ColorRowRed As Boolean Set WS = Worksheets.Add WS.Range("A1:D10").BorderAround xlSolid, xlThick, 6 For Each R In Range("A1:D10").Rows ColorRowRed = Not ColorRowRed ColorRed = ColorRowRed For Each Rng In R.Cells If ColorRed = True Then Rng.Interior.ColorIndex = 3 Else Rng.Interior.ColorIndex = 4 End If ColorRed = Not ColorRed Next Rng Next R -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "MarkJones" wrote in message ... This is probably very easy to do, however I've got no clue as to what I'm doing... Basically I need to program a macro to do the following... 1. Create a new Sheet in an Excel Workbook 2. Draw a grid from Cells A:1 to D:10 3. Format the grid with thick lined borders in Yellow 4. Colour each cell with alternate Red and green colours. Now I've made an effort and I've got 1 done (I think) Insert New WorkSheet Any help would be really appriciated as this is very important that I actually complete this. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie needs help
Right I've done as you said Sub Excel Test() Sheets("Sheet1").Select Sheets.Add Range("A1:D10").Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThick .ColorIndex = 6 End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThick .ColorIndex = 6 End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThick .ColorIndex = 6 End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThick .ColorIndex = 6 End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThick .ColorIndex = 6 End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThick .ColorIndex = 6 End With Range("A1,C1,B2,D2,C3,A3,B4,D4,C5,A5,B6,D6,C7,A7,B 8,D8,C9,A9,B10,D10").Select Range("D10").Activate With Selection.Interior .ColorIndex = 3 .Pattern = xlSolid End With Range("A2,B1,B3,C2,D1,D3,C4,D5,C6,D7,C8,D9,C10,B9, A10,A8,B7,A6,B5,A4").Select Range("A4").Activate Selection.Font.ColorIndex = 4 With Selection.Interior .ColorIndex = 4 .Pattern = xlSolid End With Range("E11").Select End Sub Does that require cleaning in any way? Or would that be acceptable yo think ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Real Newbie newbie question | New Users to Excel | |||
Can you help a NEWBIE please | Excel Discussion (Misc queries) | |||
Very very new newbie | New Users to Excel | |||
Help for a newbie? | Excel Worksheet Functions | |||
JET dB Newbie Needs Help | Excel Discussion (Misc queries) |