![]() |
#1
|
|||
|
|||
![]()
I have written the following code to make excel go to nth direct precedents of a cell which are in the same sheet. (As far as I know, there is no way to write a code that does this job for precedents which are out of the sheet the active cell lies.) it failes to do its expected job. (see the excel attachment, when running the code for cell E1 and entering 2 in the input box appearing after running the code, it is expected to go to cell D4 but it goes to cell c2.
Sub gotopresedence() Dim Rng As Range, RngPrecedents As Range Dim i As Long, j As Long Application.Goto Reference:=Selection Set Rng = ActiveCell Set RngPrecedents = Rng.DirectPrecedents Application.Goto Reference:=RngPrecedents(InputBox("what presedence")) End Sub |
Tags |
prcedent |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
littlepeaks | Word VBA | 5 | 08-24-2022 09:14 PM |
Move active cell down | Marcia | Excel Programming | 2 | 06-22-2022 04:10 PM |
![]() |
Peterson | Excel Programming | 3 | 03-07-2021 12:19 PM |
Cell equal value new value of active cell which is a drop down | hassanmoukadem | Excel Programming | 1 | 04-13-2020 07:54 PM |
![]() |
FUGMAN | Excel Programming | 7 | 02-05-2017 08:37 AM |