I have a spreadsheat were macro1 is cast days. I want to assign another macro to make the cursor no matter where I am on the page move to the last time macro 1 was run.Any ideas?
I have a spreadsheat were macro1 is cast days. I want to assign another macro to make the cursor no matter where I am on the page move to the last time macro 1 was run.Any ideas?
Add a new name to the workbook, say LastCell
Make the last line in macro 1: ActiveWorkbook.Names.Item("LastCell").Value = ActiveCell.Address(0, 0)
Ben Van Johnson
I am not sure I follow. Here is my code, could you help alittle further?
![]()
Sub CastDay() ' ' CastDay Macro ' ' Keyboard Shortcut: Ctrl+d ' ActiveWorkbook.Names.Item("LastCell").Value = ActiveCell.Adress(0)(0) End With ActiveCell.Offset(1, 0).Range("A1:ED1").Select With Selection.Font .Color = -16776961 .TintAndShade = 0 End With With Selection.Interior .Pattern = xlNone .TintAndShade = 0 .PatternTintAndShade = 0 End With Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Color = -16776961 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Color = -16776961 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Color = -16776961 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Color = -16776961 .TintAndShade = 0 .Weight = xlMedium End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Color = -16776961 .TintAndShade = 0 .Weight = xlMedium End With Selection.Borders(xlInsideHorizontal).LineStyle = xlNone ActiveCell.Offset(1, 0).Range("A1").Select End Sub
Last edited by Cutter; 08-03-2012 at 05:30 PM. Reason: Added code tags
@ tperkins1973
Welcome to the forum.
Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
Thanks.
1. Did you create the Name? If you did not, copy the macro below to the workbook and run it ONE time.
To save the last cell used by CastDay, put the line below as the last line of the CastDay macro, not the first:![]()
Sub AddName() ActiveWorkbook.Names.Add Name:="LastCell", RefersTo:="""" End Sub
![]()
ActiveWorkbook.Names("LastCell").Value = ActiveCell.Address(0, 0)
...I want to assign another macro to make the cursor...move to the last time macro 1 [i.e., CastDay] was run...
So, when you write the macro that's going to use that cell address add the below:
![]()
Dim LC As String ' Load the last active cell from CastDay from the LastCell storage name LC = ActiveWorkbook.Names("lastcell").Value 'strip off the first two characters (=") and the last (") LC = Mid(LC, 3, Len(LC) - 3) 'select that cell Range(LC).Select
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks