Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
simple question about excel Μανολης Β Excel Discussion (Misc queries) 5 November 18th 09 10:13 AM
Simple Excel Question Maurice Excel Discussion (Misc queries) 6 August 3rd 09 09:19 PM
Simple VB for Excel Question Don Excel Discussion (Misc queries) 3 July 2nd 08 07:49 PM
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM


All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"