LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
traineeross
 
Posts: n/a
Default Macros in excel 2000

I have recorded a macro to convert a report sent to us by another department.
This involves inserting extra columns to use formulas to convert the data.
However as the amount of rows varies with the amount of data, how do i get
the macro to work by going to the last active cell in a column? It is the
first long macro i have written so any help would be much appreciated. I have
included the macro to help.

Sub CRMReportMacro()
'
' CRMReportMacro Macro
' Macro recorded 11/08/2005 by Administrator
'
' Keyboard Shortcut: Ctrl+j
'
Range("H2").Select
Selection.EntireColumn.Insert
Selection.EntireColumn.Insert
Selection.EntireColumn.Insert
Selection.EntireColumn.Insert
Selection.EntireColumn.Insert
Range("H1").Select
ActiveCell.FormulaR1C1 = "Time Req"
Range("I1").Select
ActiveCell.FormulaR1C1 = "Time Closed"
Range("L1").Select
ActiveCell.FormulaR1C1 = "Time In Hours"
Range("F2:F1101").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=-27
ActiveWindow.LargeScroll Down:=-34
Range("H3").Select
ActiveWindow.SmallScroll Down:=-6
Range("H2").Select
ActiveSheet.Paste
Range("G2:G1101").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.LargeScroll Down:=-33
ActiveWindow.ScrollRow = 2
Range("I2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.Save
Range("H:I,L:L").Select
Range("L1").Activate
Selection.NumberFormat = "h:mm"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-3]-RC[-4])"
Selection.Copy
Range("L3:L1101").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-39
ActiveWindow.LargeScroll Down:=-33
ActiveWindow.ScrollRow = 2
Application.CutCopyMode = False
ActiveWorkbook.Save
Range("K2").Select
ActiveCell.FormulaR1C1 = "DAYS"
Range("K2").Select
Selection.Copy
Range("K3:K1101").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-9
Columns("K:K").ColumnWidth = 5.29
ActiveWindow.LargeScroll Down:=-35
Application.CutCopyMode = False
ActiveWorkbook.Save
Range("J1").Select
ActiveCell.FormulaR1C1 = "Net-Work Days"
Range("J2").Select
ActiveCell.FormulaR1C1 = "=NETWORKDAYS(RC[-4],RC[-3])"
Columns("J:J").Select
Selection.NumberFormat = "General"
Range("J2").Select
Selection.Copy
Range("J3:J1101").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.Save
ActiveWindow.LargeScroll Down:=-35
Columns("J:J").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLessEqual, _
Formula1:="3"
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _
Formula1:="3"
With Selection.FormatConditions(2).Font
.Bold = True
.Italic = False
.ColorIndex = 3
End With
ActiveWindow.SmallScroll Down:=546
ActiveWindow.LargeScroll Down:=16
ActiveWindow.ScrollRow = 1071
ActiveWindow.SmallScroll Down:=15
Range("I1102").Select
ActiveCell.FormulaR1C1 = "Over 2 Days"
Range("I1103").Select
ActiveCell.FormulaR1C1 = "Under 2 Days"
Range("J1102").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(R[-1100]C:R[-1]C,""3"")"
Application.Run Range("AUTOSAVE.XLA!mcs02.OnTime")
ActiveWindow.SmallScroll Down:=12
Range("J1103").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(R[-1101]C:R[-2]C,""<=3"")"
ActiveWindow.SmallScroll Down:=12
Range("J1102:J1103").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
ActiveWindow.SmallScroll Down:=-45
Columns("L:L").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.MergeCells = False
End With
End Sub

 
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
Hyperlink in Excel 2000 can't open bookmarked Word 2000 file DCheslock Excel Discussion (Misc queries) 1 May 5th 05 10:46 PM
Excel XP 2002 Vs. Excel 2000 Samantha Excel Discussion (Misc queries) 0 April 18th 05 03:54 PM
other systems detecting excel 4.0 if excel 2000 is installed Tristan_Flynn Setting up and Configuration of Excel 0 January 18th 05 06:55 PM
How do I Break links Using Excel 2000 DaddyMan Excel Discussion (Misc queries) 1 December 9th 04 10:18 PM
Statistical Excel Function Question within Excel 2000... Drew H Excel Worksheet Functions 3 October 31st 04 06:55 PM


All times are GMT +1. The time now is 02:46 PM.

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

About Us

"It's about Microsoft Excel"