DataPanda
New Member
- Joined
- Jun 22, 2022
- Messages
- 3
- Office Version
- 365
- 2021
- 2019
- 2016
- 2011
- 2010
- 2007
- Platform
- Windows
- MacOS
Hi.
I'm trying to write some VBA in a rush but haven't had time to properly learn it to struggling a bit
What I want, is that when someone clicks or double clicks on a cell in Column B Sheet 1 (e.g. folder B), then the VBA will look at the adjacent Column A Sheet 1 (which will be hidden) and find the value there (e.g. C:/folderA/folderB). It will search Column A Sheet 2 for this value and (a) set that as the active cell and (b) set it to be the top-left cell on the screen.
I've identified some VBA that may help, I just don't know how to put it all together:
Sheet 1:
Sheet 2:
I'm trying to write some VBA in a rush but haven't had time to properly learn it to struggling a bit
What I want, is that when someone clicks or double clicks on a cell in Column B Sheet 1 (e.g. folder B), then the VBA will look at the adjacent Column A Sheet 1 (which will be hidden) and find the value there (e.g. C:/folderA/folderB). It will search Column A Sheet 2 for this value and (a) set that as the active cell and (b) set it to be the top-left cell on the screen.
I've identified some VBA that may help, I just don't know how to put it all together:
VBA Code:
' Set cell as the top left cell
Application.Goto <something here>, True
` Change active cell to cell on the left
ActiveCell.Offset(0, -1)
Sheet 1:
FOLDERS (column A Sheet 1) | CONTENTS (column B Sheet 1) |
---|---|
C:/folderA | folderA |
C:/folderA/folderB | folderB |
C:/folderC | folderC |
C:folderD | folderD |
Sheet 2:
PATHS (column A Sheet 2) |
---|
C:/folderA |
C:/folderA/folderB |
C:/folderA/folderB/fileA.txt |
C:/folderC |
C:/folderC/fileB.txt |
C:folderD |