fixing error invalid procedure call or argument

Anonymous
2020-10-17T11:47:16+00:00

hello  i got  this  code from some member from  some  forum  he  told  me  it  works  for  him  but  me   not   it gives me error "invalid procedure call or argument " and highlight in this line

HTML Code:

.Columns(i).FormatConditions.Add 2, Formula1:="=and(left(" & _
                .Cells(1, i).Address(0, 0) & ",3)<>""job""," & "countif(" & _
                .Columns(i).Address & "," & .Cells(1, i).Address(0, 0) & ")>1)"

Sub test()

    Dim i As Long

    With [c1].CurrentRegion

        .FormatConditions.Delete

        For i = 1 To .Columns.Count

            .Columns(i).FormatConditions.Add 2, Formula1:="=and(left(" & _

                .Cells(1, i).Address(0, 0) & ",3)<>""job""," & "countif(" & _

                .Columns(i).Address & "," & .Cells(1, i).Address(0, 0) & ")>1)"

            .FormatConditions(.FormatConditions.Count).Interior.Color = vbRed

        Next

    End With

End Sub

so  i would truly appreciate  if  any  body   find out what's  the  problem  with me 

thanks  in advance

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

8 answers

Sort by: Most helpful
  1. Anonymous
    2020-10-19T09:18:29+00:00
    0 comments No comments
  2. OssieMac 47,981 Reputation points Volunteer Moderator
    2020-10-19T23:33:53+00:00

    OK I got your workbook and tested and it works fine for me. See Screen Shot below with the results.

    Refer to the following link for a known problem/bug that I believe has now been rectified.

    https://codekabinett.com/rdumps.php?Lang=2&targetDoc=invalid-procedure-call-error-windows-update-2019-08-august 

    I suggest that you ensure you have the latest Office Updates. Open Excel and  Select File -> Account -> Update options -> Update now

    Repeat the update procedure until it returns a message "You're up to date The latest version of Office is installed on your computer"

    If you are unable to update because you are in a business where updating is controlled by your IT personnel then talk with your IT Administrator and refer to the known problem above and get the latest updates.

    0 comments No comments
  3. Anonymous
    2020-10-21T13:13:22+00:00

    hi, OssieMac   i  would  thank  you   for  interesting  to  solve  my  problem  ,actually  it  taked  me  one  day  to  search  way  for  fix it  but  unfortunately   it  doesn't  success  despite  i  updated the  windows 10  and  the  Microsoft office  2016  and  use  three computers  with all of this  nothing   changes     the  error remains   as it is  

    best regards,

    abdelfattah

    0 comments No comments