Results 1 to 4 of 4

Compile error As "Wrong number of argument or argument or invalid Property assignment

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-12-2010
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    134

    Compile error As "Wrong number of argument or argument or invalid Property assignment

    hi
    here i have code that give the Compile error As
    "Wrong number of argument or argument or invalid Property assignment

    Private Sub cmdOK_Click()
        Dim i As Long
        Dim NSname As Worksheet
        Dim Sheetname As String
       
      
        If Not ComboBox1.ListIndex = -1 Then
            Sheetname = ComboBox1.Value 'InputBox("Please enter new sheet name")
            
                Workbooks.Open Filename:= _
            "C:\Documents and Settings\g sheet\daily data\target.xls"
            Windows("Check In Data.xls").Activate
            Sheets("Today").Select
            Sheets("Today").Copy After:=Workbooks("target.xls").Sheets(Workbooks("target.xls").Sheets.Count)
            'Sheets("Today").Copy After:=Worksheets(Worksheets.Count)
            'Sheets("To Day").Copy after:=Workbooks("target.xls").Sheets(1)
            ActiveSheet.Name = Sheetname
            ActiveSheet.Unprotect Password:=""
            ActiveSheet.Range("A3").Value = Sheetname
            ActiveSheet.Range("L3").Value = Now()
            ActiveSheet.Protect Password:=""
         Workbooks.Close SaveChanges:=True  'here is the problem athere than  that it's work fine
            Unload Me
        Else
            Unload Me
            MsgBox "Pick a sheet!", 0, vbNullString
        End If
        
    End Sub
    actually i want to close the WB which just copy past so save the WB and close the same
    can u help me pl.
    Last edited by jay11; 04-28-2010 at 04:09 PM.

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