fishingsantafe
New Member
- Joined
- Sep 1, 2005
- Messages
- 13
Here is a Macro I recorded.
The July 07 in the formula is the name of the worksheet before the active sheet. Is there a way to tell it to go to the previous worksheet Look at column A which will vary as to how many rows to see if the information in A2 of the active worksheet is found in column A of the previous sheet. If it is not found in column A then enter "true" in B of the active work sheet. If it is found on in column A on the previous sheet then enter "false" in B2 on the active worksheet. ( I want to compare numbers in Column A on active to Column A on the Worksheet before the active one to find new infomation that was added to the current months worksheet.
This works but I have always change the name of the worksheet every month I run it and I also have to change the range of the previous worksheet because this will vary every month. Is there and easy way to tell it to stop looking when it hits a blank row in column A on the previous worksheet? Any help is appreciated. I am a beginner at VB but am learning more each day. Hope this is not to confusing. I use Excel 2003
Code:
Sub insertcolumn()
'
' insertcolumn Macro
' Macro recorded 07/20/2007 by e337ljs
'
' Keyboard Shortcut: Ctrl+t
'
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("B1").Select
ActiveCell.FormulaR1C1 = "New files"
With ActiveCell.Characters(Start:=1, Length:=9).Font
.Name = "Tahoma"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 55
End With
Range("B2").Select
ActiveCell.FormulaR1C1 = _
"=ISNA(MATCH(RC[-1],'July 07'!RC[-1]:R[43]C[-1],FALSE))"
Range("B2").Select
End Sub
The July 07 in the formula is the name of the worksheet before the active sheet. Is there a way to tell it to go to the previous worksheet Look at column A which will vary as to how many rows to see if the information in A2 of the active worksheet is found in column A of the previous sheet. If it is not found in column A then enter "true" in B of the active work sheet. If it is found on in column A on the previous sheet then enter "false" in B2 on the active worksheet. ( I want to compare numbers in Column A on active to Column A on the Worksheet before the active one to find new infomation that was added to the current months worksheet.
This works but I have always change the name of the worksheet every month I run it and I also have to change the range of the previous worksheet because this will vary every month. Is there and easy way to tell it to stop looking when it hits a blank row in column A on the previous worksheet? Any help is appreciated. I am a beginner at VB but am learning more each day. Hope this is not to confusing. I use Excel 2003