Results 1 to 6 of 6

error 1004 application define or object define

Threaded View

jay11 error 1004 application define... 04-14-2010, 06:37 PM
jay11 Re: VB code need to refine 04-15-2010, 07:38 PM
shg Re: VB code need to refine 04-15-2010, 08:04 PM
jay11 Re: VB code need to refine 04-16-2010, 10:09 AM
jay11 Re: error 1004 application... 04-17-2010, 09:57 AM
Sarangsood sorry posted by mistake 08-11-2011, 04:09 AM
  1. #1
    Forum Contributor
    Join Date
    02-12-2010
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    134

    Question error 1004 application define or object define

    hi
    can some one pl help on this?
    here is the code for getting the data from 1 sheet and copies the same to anther sheet after copies i want to delete the same row from
    1 sheet and move the remaining data row up in the 1 sheet
    any help will be appreciated
    thanks

    Private Sub Enterdata_Click()
        Dim n As Long
        Dim ws As Worksheet
        Dim R As Range
        Dim var
        Dim i&
           
        With Worksheets("Brought")
            n = Application.Match((Me.CombTicker.Value), .Range("A:A"), 0)
            .Cells(n, 4).Value = Me.noofstock.Text
          
        End With
          
    If Trim(Me.CombTicker.Value) = "" Then
      Me.CombTicker.SetFocus
      MsgBox "Please enter a Ticker"
      Exit Sub
    End If
    
    Set ws = Worksheets("Historical Data")
    
    For i = 2 To ws.Cells(Rows.Count, 1).End(xlUp).Row
        If Me.CombTicker.Value = ws.Cells(i, 1).Value Then
            If MsgBox("Ticker already exists in records.  Do you still want to add the data to the records?", vbYesNo) = vbNo Then
                Exit Sub
            Else
                Exit For
            End If
        End If
    Next i
    
    Set Rng = ws.Range("A2")
    Set RngEnd = ws.Cells(Rows.Count, Rng.Column).End(xlUp)
    NextRow = IIf(RngEnd.Row < Rng.Row, Rng.Row, RngEnd.Row + 1)
    
      With Worksheets("Brought")
        If Trim(.Cells(n, "A")) = Trim(CombTicker.Value) And _
           Trim(.Cells(n, "D")) = Trim(noofstock.Value) Then
         
        With ws
          .Cells(NextRow, "A").Resize(1, 10) = Worksheets("Brought").Cells(n, "A").Resize(1, 10).Value
          .Cells(NextRow, "K").Value = Me.DTPicker1.Value
          .Cells(NextRow, "L").Value = Me.txtHighofDay.Value
          .Cells(NextRow, "M").Value = Me.txtLowofDay.Value
          .Cells(NextRow, "N").Value = Me.txtExitPrice.Value
          .Cells(NextRow, "O").Value = Me.txtcommission.Value
        
        End With
        
        End If
       
       If MsgBox("Delete Data row from Brought Sheet and move the row up?", vbYesNo) = vbYes Then
            Cancel = True
          Dim c As Range
            With Sheets("Brought").Range("Ticker")
            Set c = .Find(vreg, LookIn:=xlValues, lookat:=xlWhole)
            If Not c Is Nothing Then drow = c.Row
            c.EntireRow.Delete
        End With
            
            
        End If
       
      End With
      
      
    'clear the data
    Me.CombTicker.Value = ""
    'Me.txtExitDate.Value = Format(Date, "Medium Date")
    Me.txtExitPrice.Value = ""
    Me.txtcommission = 7
    Me.txtHighofDay.Value = ""
    Me.txtLowofDay.Value = ""
    Me.CombTicker.SetFocus
    
    End Sub
    Last edited by jay11; 04-16-2010 at 06:21 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