ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Newbie needs help (https://www.excelbanter.com/excel-programming/283764-newbie-needs-help.html)

MarkJones

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


Don Guillett[_4_]

Newbie needs help
 
Sounds sort of like homework to me.
Try recording a macro while you do this. Then clean it up.

--
Don Guillett
SalesAid Software

"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/




Ron de Bruin

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/




MarkJones[_2_]

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


Chip Pearson[_2_]

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/




MarkJones[_3_]

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



All times are GMT +1. The time now is 02:59 AM.

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