Share via

Better than hyperlink

Anonymous
2022-12-19T18:03:35+00:00

I want to put on one of my worsheets (have many entries on it) to do the following.
on one worksheet, every _+ 9 rows I have a name, from B9: to B968 (there will be more added in future.
The names I get from "Chart of Accounts", and need to add them in "GL-MO 10"
There are two diffrent options (inkomste) and (uitgawes)

I am trying it with hyperlink, but the names can change or new ones added, is there a better way to do it with code.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2022-12-21T11:01:18+00:00

Change

Set Target = Intersect(Target, Range("I:I"))

to

Set Target = Intersect(Target, Range("I:L"))

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

Answer accepted by question author

Anonymous
2022-12-21T08:01:22+00:00

Right-click on the sheet tab
Choose "View Code"
Paste in the code below
Close the VBA editor
Select a cell in column I

Does it work as expected?

Andreas.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Dest As Range
If Target.CountLarge > 1 Then Exit Sub
Set Target = Intersect(Target, Range("I:I"))
If Target Is Nothing Then Exit Sub
Set Dest = Range("B:B").Find(Target, LookIn:=xlValues, LookAt:=xlWhole)
If Dest Is Nothing Then
MsgBox Target, vbInformation, "Not found"
Else
Application.EnableEvents = False
Dest.Select
Application.EnableEvents = True
End If
End Sub

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2022-12-21T08:34:04+00:00

    Thank you it is working, but if I split the names in 4 columns (to see it on the screen) (I,J,K and L) wich line do I have to change

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2022-12-20T14:01:01+00:00

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2022-12-20T08:11:36+00:00

    It is far too complicated to recreate such a scenario. And if it does not match yours, then our solution will not work for you.

    For this kind of requests, please create a sample file with the layout of your original file, filled with sample data and colored cells with the expected result.

    At best make a copy of your original file and anonymize the necessary data. For this please download this file
    https://www.dropbox.com/s/rkfxuh85j5wyj9y/modAnonymize.bas?dl=1
    Open your Excel file
    Right-click on the sheet tab
    Choose "View Code"
    Press CTRL-M
    Select the downloaded file and import
    Close the VBA editor
    Select the cells with the confidential data
    Press Alt-F8
    Choose the macro Anonymize
    Click Run

    Upload it on OneDrive (or an other Online File Hoster of your choice) and post the download link here.
    https://support.office.com/en-us/article/Share-OneDrive-files-and-folders-9fcc2f7d-de0c-4cec-93b0-a82024800c07

    Then we can look at the file and try to find a solution. Thank you for your understanding.

    Andreas.

    Was this answer helpful?

    0 comments No comments