Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Excel Question
I have this formula:
Sub Format_CZE1210andXYZ() ' ' Format_CZE1210 Macro ' Format E-BASH ' ' Keyboard Shortcut: Ctrl+w ' Cells.Select Range("A6").Activate With Selection.Font .Name = "Arial" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With Rows("1:1").Select With Selection.Font .Name = "Arial" .Size = 6 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With Selection.AutoFilter Columns("F:F").Select Selection.EntireColumn.Hidden = True ActiveWindow.Zoom = 75 Range("A2").Select ActiveWindow.FreezePanes = True Range("N2").Select Selection.End(xlDown).Select ActiveCell.Offset(2, 0).Range("A1").Select ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-1125]C:R[-2] C)" ActiveCell.Offset(1, 0).Range("A1").Select ActiveCell.FormulaR1C1 = "=R[-1]C/2000" ActiveCell.Select Selection.NumberFormat = "#,##0" ActiveCell.Offset(-1, -1).Range("A1").Select ActiveCell.FormulaR1C1 = "POUNDS" ActiveCell.Offset(1, 0).Range("A1").Select ActiveCell.FormulaR1C1 = "TONS" ActiveCell.Offset(-1, 1).Range("A1:A2").Select Selection.Copy ActiveWindow.SmallScroll ToRight:=10 ActiveCell.Offset(0, 1).Range("A1").Select ActiveSheet.Paste ActiveCell.Offset(0, 2).Range("A1").Select ActiveSheet.Paste ActiveCell.Offset(0, 2).Range("A1:F1").Select ActiveSheet.Paste Application.CutCopyMode = False ActiveCell.Offset(1, 6).Range("A1").Select ActiveCell.FormulaR1C1 = "=SUBTOTAL(1,R[-3]C)" ActiveCell.Select ActiveCell.FormulaR1C1 = "=SUBTOTAL(1,R[-1126]C:R[-3] C)" ActiveCell.Select Selection.NumberFormat = "0.0" ActiveCell.Offset(-1, 0).Range("A1").Select ActiveCell.FormulaR1C1 = "AVG DAYS" ActiveCell.Offset(1, 0).Range("A1").Select With ActiveSheet.PageSetup .LeftHeader = "" .CenterHeader = "" .RightHeader = "" .LeftFooter = "" .CenterFooter = "" .RightFooter = "" .LeftMargin = Application.InchesToPoints(0) .RightMargin = Application.InchesToPoints(0) .TopMargin = Application.InchesToPoints(0) .BottomMargin = Application.InchesToPoints(0) .HeaderMargin = Application.InchesToPoints(0.5) .FooterMargin = Application.InchesToPoints(0.5) .PrintHeadings = False .PrintGridlines = True .PrintComments = xlPrintNoComments .PrintQuality = 600 .CenterHorizontally = False .CenterVertically = False .Orientation = xlLandscape .Draft = False .PaperSize = xlPaperLetter .FirstPageNumber = xlAutomatic .Order = xlDownThenOver .BlackAndWhite = False .Zoom = 100 End With ActiveWindow.SelectedSheets.PrintPreview ActiveWindow.SmallScroll ToRight:=15 ActiveSheet.PageSetup.PrintArea = "$A$1:$Y$1128" ActiveWindow.SmallScroll ToRight:=-8 ActiveWindow.View = xlNormalView End Sub How do I add the following to the above and make it reference the "TONS" line and place itself right below it. My problem is that I can my formula only works if the data does not exceed the box physical cell that I selected, so I need to do the "offset" thing, I think, judging by the programming for the other two. Please help a poor stupid intern out. ***************ADDD THIS************ Range("M1179").Select ActiveCell.FormulaR1C1 = "LOADS" Range("O1179").Select ActiveCell.FormulaR1C1 = "=SUM((R[-2]C)+(R[-2]C [2]))/42000" Range("T1179").Select ActiveCell.FormulaR1C1 = "=SUM(R[-2]C)/42000" Range("T1180").Select Range("M1179").Select ActiveCell.FormulaR1C1 = "LOADS" Range("O1179").Select ActiveCell.FormulaR1C1 = "=SUM((R[-2]C)+(R[-2]C [2]))/42000" Range("T1179").Select ActiveCell.FormulaR1C1 = "=SUM((R[-2]C[-5])+(R[-2]C[- 3])-(R[-2]C[-1]))/42000" Range("T1180").Select Range("A2").Select |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
simple question about excel | Excel Discussion (Misc queries) | |||
Simple Excel Question | Excel Discussion (Misc queries) | |||
Simple VB for Excel Question | Excel Discussion (Misc queries) | |||
IF formula-simple question; simple operator | Excel Discussion (Misc queries) | |||
Simple Simple Excel usage question | Excel Discussion (Misc queries) |