+ Reply to Thread
Results 1 to 4 of 4

Relative reference not working when using macros

  1. #1
    Registered User
    Join Date
    06-09-2014
    Posts
    3

    Relative reference not working when using macros

    I'm trying to do is delete a row of chosen cells in my form (form is locked with a password) using a macro then return back to the first cell below the deleted row. When I run the macro what's happening is that it's returning back to the cell chosen while writing the macro (which is at the very top A7). So if I'm several rows below A7, it deletes the row and then returns all the way back to the top of the form causing the user to have to scroll back down to where they were. Does anyone know how to fix this?

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Relative reference not working when using macros

    Please share your code with us for correction


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    06-09-2014
    Posts
    3

    Re: Relative reference not working when using macros

    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    ActiveSheet.Unprotect Password:="please"
    ActiveCell.Range("A1:AI1").Select
    Selection.Delete Shift:=xlUp
    ActiveCell.Select
    Sheets("Parts").Select
    Sheets("Sheet").Visible = True
    Application.Goto Reference:="Delete_Row1"
    Selection.Copy
    Sheets("Parts").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Application.Goto Reference:="Delete_Row2"
    Selection.Copy
    Sheets("Parts").Select
    ActiveCell.Offset(0, 12).Range("A1").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.Offset(0, -12).Range("A1").Select
    Application.Goto Reference:="Sheet_End"
    Sheets("Sheet").Select
    ActiveWindow.SelectedSheets.Visible = False
    Application.Goto Reference:="Delete_Refresh"
    Selection.AutoFill Destination:=ActiveCell.Range("A1:B1000"), Type:= _
    xlFillDefault
    ActiveCell.Range("A1:B1000").Select
    ActiveWindow.ScrollColumn = 1
    ActiveCell.Offset(2, -33).Range("A1").Select
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
    , AllowInsertingRows:=True, AllowSorting:=True, AllowFiltering:=True, Password:="please"
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic
    End Sub

  4. #4
    Registered User
    Join Date
    06-09-2014
    Posts
    3

    Re: Relative reference not working when using macros

    Any idea as to why my relative reference is not working?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Relative reference not working when using macros
    By pegleg68john in forum Hello..Introduce yourself
    Replies: 3
    Last Post: 06-13-2014, 05:45 PM
  2. [SOLVED] relative reference not working
    By Zealotwraith in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-25-2013, 03:37 PM
  3. using relative reference in macros
    By ilundy77 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2010, 04:39 PM
  4. $ Relative Reference not Working
    By mcball22 in forum Excel General
    Replies: 3
    Last Post: 12-22-2006, 01:56 PM
  5. Relative Reference Help Macros
    By PhillipsHQ in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-18-2006, 10:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1