PDA

View Full Version : VBA Code (Challenging) !Heelp its for tomorowwww!!



Jean.
12-16-2012, 06:49 PM
9260

Jean.
12-16-2012, 06:58 PM
This is the whole part of making four tables, colors, lettersizes etc, I'm missing the beggining :(

Range("A1:A2").MergeCells = True
Range("B1:B2").MergeCells = True
Range("C1:C2").MergeCells = True
Range("D1:D2").MergeCells = True
Range("E1:E2").MergeCells = True
With Range("A1:E1")
.Font.ColorIndex = 2
.Interior.ColorIndex = 13
.Font.Size = 14
.Font.Name = "Times New Roman"
End With
Rows("1:8").RowHeight = 22
Columns("A").ColumnWidth = 17
Columns("B").ColumnWidth = 12
Columns("C").ColumnWidth = 13
Columns("D").ColumnWidth = 24
Columns("E").ColumnWidth = 15
Range("A1:E8").Borders.LineStyle = xlContinuous
Range("A3:E8").BorderAround (xlDouble)
Range("A1:E2").BorderAround (xlDouble)
Range("A1") = "Substance"
Range("B1") = "State"
Range("C1") = "Density"
Range("D1") = "Thermal Conductivity"
Range("E1") = "Specific Heat"

Range("G1:K1").Interior.ColorIndex = 13
Range("G1:G2").MergeCells = True
Range("H1:H2").MergeCells = True
Range("I1:I2").MergeCells = True
Range("J1:J2").MergeCells = True
Range("K1:K2").MergeCells = True
With Range("G1:K1")
.Font.ColorIndex = 2
.Font.Size = 14
.Font.Name = "Times New Roman"
End With
Rows("1:8").RowHeight = 22
Columns("G").ColumnWidth = 17
Columns("H").ColumnWidth = 12
Columns("I").ColumnWidth = 13
Columns("K").ColumnWidth = 15
Range("G1:K8").Borders.LineStyle -xlContinous
Range("G3:K8").BorderAround (xlDouble)
Range("G1:K2").BorderAround (xlDouble)
Range("G1") = "Substance"
Range("H1") = "Satate"
Range("I1") = "Density"
Range("J1") = "Thermal Conductivity"
Range("K1") = "Specific Heat"

Range("M1:Q1").Interior.ColorIndex = 13
Range("M1:M2").MergeCells = True
Range("N1:N2").MergeCells = True
Range("O1:O2").MergeCells = True
Range("P1:P2").MergeCells = True
Range("Q1:Q2").MergeCells = True
With Range("M1:Q2")
.Font.ColorIndex = 2
.Font.Size = 14
.Font.Name = "Times New Roman"
End With
Rows("1:8").RowHeight = 22
Columns("M").ColumnWidht = 17
Columns("N").ColumnWidth = 12
Columns("O").ColumnWidth = 13
Columns("P").ColumnWidth = 24
Columns("Q").ColumnWidth = 15
Range("M1:Q8").Borders.LineStyle -xlContinuous
Range("M3:Q8").BorderAround (xlDouble)
Range("M1:Q2").BorderAround (xlDouble)
Range("M1") = "Substance"
Range("N1") = "State"
Range("O1") = "Density"
Range("P1") = "Thermal Conducticity"
Range("Q1") = "Specific Heat"

Range("G1:K1").Interior.ColorIndex = 13
Range("G1:G2").MergeCells = True
Range("H1:H2").MergeCells = True
Range("I1:I2").MergeCells = True
Range("J1:J2").MergeCells = True
Range("K1:K2").MergeCells = True
With Range("G1:K1")
.Font.ColorIndex = 2
.Font.Size = 14
.Font.Name = "Times New Roman"
End With
Rows("1:8").RowHeight = 22
Columns("G").ColumnWidth = 17
Columns("N").ColumnWidth = 12
Columns("O").ColumnWidth = 13
Columns("P").ColumnWidth = 24
Columns("Q").ColumnWidth = 15
Range("M1:Q8").Borders.LineStyle = xlContinuous
Range("M3:Q8").BorderAround (xlDouble)
Range("M1:Q2").BorderAround (xlDouble)
Range("M1") = "Substance"
Range("O1") = "Density"
Range("P1") = "Thermal Conductivity"
Range("Q1") = "Specific Heat"

Range("S1:W1").Interior.ColorIndex = 13
Range("S1:S2").MergeCells = True
Range("T1:T2").MergeCells = True
Range("U1:U2").MergeCells = True
Range("V1:V2").MergeCells = True
Range("W1:W2").MergeCells = True
With Range("S1:W1")
.Font.ColorIndex = 2
.Font.Size = 14
.Font.Name = "Times New Roman"
End With
Rows("1:8").RowHeight = 22
Columns("S").ColumnWidth = 17
Columns("T").ColumnWidth = 12
Columns("U").ColumnWidth = 13
Columns("V").ColumnWidth = 24
Columns("W").ColumnWidth = 15
Range("S1:W8").Borders.LineStyle = xlContinuous
Range("S3:W8").BorderAround (xlDouble)
Range("S1:W2").BorderAround (xlDouble)
Range("S1") = "Substance"
Range("T1") = "State"
Range("U1") = "Density"
Range("V1") = "Thermal Conductivity"
Range("W1") = "Spacific Heat"

Range("Y1:AC1").Interior.ColorIndex = 13
Range("Y1:Y2").MergeCells = True
Range("Z1:Z2").MergeCells = True
Range("AA1:AA2").MergeCells = True
Range("AB1:AB2").MergeCells = True
Range("AC1:AC2").MergeCells = True
With Range("Y1:AC1")
.Font.ColorIndex = 2
.Font.Size = 14
.Font.Name = "Times New Roman"
End With
Rows("1.8").RowHeight = 22
Columns("Y").ColumnWidth = 17
Columns("Z").ColumnWidth = 12
Columns("AA").ColumnWidth = 13
Columns("AB").ColumnWidth = 24
Columns("AC").ColumnWidth = 15
Range("Y1:AC8").Borders.LineStyle = xlContinuous
Range("Y3:AC8").BorderAround (xlDouble)
Range("Y1:AC2").BorderAround (xlDouble)
Range("Y1") = "Substance"
Range("Z1") = "State"
Range("AA1") = "Density"
Range("AB1") = "Thermal conductivity"
Range("AC1") = "Specific Heat"

End Sub

Clears:

Sub clear()

With Range("A1:AC30")
.Borders.LineStyle = xlNone
.HorizontalAlignment Alignment = xlCenter
.Interior.ColorIndex = 2
.ClearContents
With .Font
.Bold = False
.Italic = False
End With

End Sub

Sub Clear2()

With Range("G1:AC30")
.Borders.LineStyle = xlNone
.HorizontalAlignment = xlCenter
.Interior.ColorIndex = 2
.clear contents
With .Font
.Bold = False
.Italic = False
End With
End With

End Sub







End Sub

macropod
12-16-2012, 07:42 PM
See answer here: http://www.vbaexpress.com/forum/faq.php?faq=psting_faq_item#faq_hom_faq_item

Jean.
12-16-2012, 07:48 PM
I'm really sorry that I didn't follow the rules, this is an assignment that was given to me and my partner and we each took half and half of the assignment, he did the whole part of the tables, colors of letter etc.. But I had to do the beggining of the code and due to a family member tragedy I skipped the class where we where taught how to code using arrays and recursions, so therefore that's where I'm stuck, once again sorry to bother you with this.

snb
12-17-2012, 02:16 AM
No problem, you still have 24 hours to go....