Compile error: ambiguous name detected vba excel Jan-06-17

Anonymous
2017-01-06T18:14:40+00:00

when i add another VBA into the same Sheet its produce a Complile error: ambigous name detected vba 

please help on how can i accomplish this!

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
{count} votes

14 answers

Sort by: Most helpful
  1. Anonymous
    2017-01-07T02:06:53+00:00

    hi Bernie Thank again now it did work as you said i am going to use

    as follow!

    Private Sub Worksheet_Change(ByVal Target As Range)

        Dim i As Long

        If Intersect(Target, Range("B:D,N:P")) Is Nothing Then Exit Sub

        Application.EnableEvents = False

        For i = Target.Cells(1).Row To Target.Cells(Target.Cells.Count).Row

            If Cells(i, "B").Value <> "" And Cells(i, "C").Value <> "" And Cells(i, "D").Value <> "" And Cells(i, "F").Value = "" Then

                Cells(i, "F").NumberFormat = "m/d/yyyy h:mm AM/PM"

                Cells(i, "F").Value = Now

            End If

            If Cells(i, "N").Value <> "" And Cells(i, "O").Value <> "" And Cells(i, "P").Value <> "" And Cells(i, "R").Value = "" Then

                Cells(i, "R").NumberFormat = "m/d/yyyy h:mm AM/PM"

                Cells(i, "R").Value = Now

            End If

        Next i

        Application.EnableEvents = True

        Range("F:F,R:R").EntireColumn.AutoFit

    the is that remain is as follow!

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Target.Column = 4 Then       i can not write any number in this cell  or even click

        Beep

        Cells(Target.Row + 1, 2).Activate

    End If

        If Target.Column = 17 Then    i can not write any number in this cell or even click

        Beep

        Cells(Target.Row + 1, 15).Activate

    End If

    End Sub

    if i change target 4 and 17 it work but then my Laser measurement tool wont work!

    0 comments No comments
  2. Anonymous
    2017-01-07T02:08:02+00:00

    hi John, you are right! thank you.

    0 comments No comments
  3. Anonymous
    2017-01-07T02:13:11+00:00

    thank you Gord i did looked but i was a bit of lost on the Excel files you have on the onedrive, now if i look it might make more sense, Bernie is doing a good job as well trying to help, thank you you all, this is a great room, ive been dealing with computers for 20 years my personal stuff and this is a first time seeking for help, it could not be any better.

    0 comments No comments
  4. Anonymous
    2017-01-09T16:11:50+00:00

    Better to describe what you need for the code to work than to say it doesn't work - it doesn't work because any time you select those cells, your code selects the cells 2 or 15 columns to the right. You might want to check the state of those cells and allow them to be selected if they are empty: 

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Target.Column = 4 Then

        Beep

        If Target.Value <> "" Then Cells(Target.Row + 1, 2).Activate

    End If

        If Target.Column = 17 Then

        Beep

        If Target.Value <> "" Then Cells(Target.Row + 1, 15).Activate

    End If

    End Sub

    0 comments No comments
  5. Anonymous
    2017-01-09T22:18:37+00:00

    Thank you, well appreciated, may i ask how to i allow them to be selected if they are empty?.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Target.Column = 4 Then

        Beep

        If Target.Value <> "" Then Cells(Target.Row + 1, 2).Activate

    End If

        If Target.Column = 17 Then

        Beep

        If Target.Value <> "" Then Cells(Target.Row + 1, 15).Activate

    End If

    End Sub

    0 comments No comments