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. OssieMac 47,981 Reputation points Volunteer Moderator
    2020-10-18T04:03:43+00:00

    Works for me under test I can't identify any problems. See  screen shot below.

    If you zip your workbook and upload to OneDrive and post a link to it then I will have a look at it for you. Please don't upload an unzipped file because they open with Excel on line which does not have all of the functionality. Also only use Win Zip; not third party compression like RAR files.

    0 comments No comments
  2. Anonymous
    2020-10-18T08:33:04+00:00

    hi, OssieMac      thanks  for  your  responding   the  problem   is  the  same  file  work  for someone  but  not  for  me  i  would   if  any body help  or face  the  same  problem fixing this error  throughout experience  tell me  why  this error show  me   any way  i  attached   my  file   two links  type xlsm, zip 

    https://drive.google.com/file/d/1kcDyBzfmM4GeY0g5tO4aBM-hmoWeFO4D/view?usp=sharing

    https://drive.google.com/file/d/1U-twQps9wvNjsgCjQ4gJHLSu-CHL_oyT/view?usp=sharing

    thanks advance

    0 comments No comments
  3. OssieMac 47,981 Reputation points Volunteer Moderator
    2020-10-18T10:12:04+00:00

    Unfortunately I do not have the required access to the files. Can you upload the zipped file to OneDrive and post the link.

    0 comments No comments
  4. Anonymous
    2020-10-18T12:28:49+00:00

    Unfortunately I do not have the required access to the files. Can you upload the zipped file to OneDrive and post the link.

     i did uploaded  two  links  the  first  is   zip    did you try open it ?

    0 comments No comments
  5. OssieMac 47,981 Reputation points Volunteer Moderator
    2020-10-18T20:10:30+00:00

    Unfortunately I do not have the required access to the files. Can you upload the zipped file to OneDrive and post the link.

     i did uploaded  two  links  the  first  is   zip    did you try open it ?

    You didn't upload to the Microsoft OneDrive; You uploaded to a Google drive and it tells me I do not have permission to open them.

    Guidelines to upload a workbook on OneDrive. (If you already use OneDrive and your process for saving to it is different then you can probably start at step 8 to get the link but please zip the file before uploading.)

    Sharing links to business OneDrive often does not work because the business has applied security measures that prevent this. Some people take a copy of the workbook home and upload from their private OneDrive.

    1. Zip your workbooks. Do not just save an unzipped workbook to OneDrive because the workbooks open with On-Line Excel and the limited functionality with the On-Line version causes problems.
    2. To Zip a file: In Windows Explorer Right click on the selected file and select Send to -> Compressed (zipped) folder). By holding the Ctrl key and left click once on each file, you can select multiple workbooks before right clicking over one of the selections to send to a compressed file and they will all be included into the one Zip file.
    3. Do not use 3rd party compression applications because I cannot unzip them. I do not clog up my computer with 3rd party apps when there are perfectly good apps supplied with windows.
    4. Go to this link.  https://onedrive.live.com
    5. Use the same login Id and Password that you use for this forum.
    6. Select Upload under the blue bar across the top and browse to the zipped folder to be uploaded.
    7. Select Open (or just double click). (Be patient and give it time to display the file after initially seeing the popup indicating it is done.)
    8. Right click the file name in OneDrive.
    9. Select Share.
    10. Click the link icon (Looks like chain links) at the bottom left of the dialog (Just above "Copy link").
    11. Click Copy button.
    12. Change back to this forum and click the "Insert Hyperlink" icon at top of the posting editor (Icon looks like chain links).
    13. Right click in the Web address field and right click and paste (or just Ctrl V to paste).
    14. Click "Insert" Button.
    0 comments No comments