Results 1 to 15 of 15

Problem with macro, gives error

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Problem with macro, gives error

    Hi I have below macro, which i have been fighting with some time now, so would be good if some can help me.

    The macro copy fields from shee No Pagado to sheet Masterinvoice.
    I have problemmake it copy cell AK37 in Sheet No Pagado, to cell K37 in sheet Masterinvoice
    I think the problem can be in this string, but i am not sure. If i type AF instead its working fine, but dont then copy this cell.

    This is the string i think can have the problem.

    For Each c In Worksheets("No pagado").Range("A" & r & ":AF" & r)
    Another thing is that in the code i unprotect the sheet and protect it again. But when i protect it again, i need it to put in the option
    Select unlocked cells, like this is ticked if you do it manually, all other are unticked.

    Here is the code and also there is a sheet you can have a look at.

    P.s code for protect sheet Masterinvoice is 1111

    Thanks

    Abjac

    the problem code.

    Sub clienteToMasternopagado()
    Sheets("No pagado").Activate
    Sheets("Masterinvoice").Unprotect Password:="1111"
    r = Selection.Row
    sarr = Split("M6,D11,D10,D12,D13,F13,D14,F14,B17,B18,B19,B20,B21,B22,B23,B24,B25,B26,B27,B28,B29,B30,B31,B32,B33,D31,D32,D33,L31,L32,L33,M12,K37,", ",")
    For Each c In Worksheets("No pagado").Range("A" & r & ":AF" & r)
      Worksheets("Masterinvoice").Range(sarr(j)) = c
      j = j + 1
    Next
    Sheets("Masterinvoice").Protect Password:="1111", DrawingObjects:=True, Contents:=True, Scenarios:=True
    Sheets("Masterinvoice").Activate
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1