Consulting

Results 1 to 3 of 3

Thread: Code limits its operation

  1. #1
    VBAX Regular
    Joined
    Aug 2013
    Posts
    56
    Location

    Code limits its operation

    Hi!

    I have this code that writes data from one worksheet to another.

    Sub Save()
    
    
    Dim ws1 As Worksheet
    Dim ws2 As Worksheet
    Dim lngRC As Long
    Dim var
    
    
    Set ws1 = Sheets("Sheet1")
    Set ws2 = Sheets("Sheet2")
    
    
    With ws2
      lngFF = .Range("B" & Rows.Count).End(xlUp).Row + 1
    End With
    
    
    var = Array(6, 11, 8, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 53, 56, 57, 58)
    
    
    For lngRC = LBound(var) To UBound(var)
      ws2.Cells(lngFF, lngRC + 2).Value = ws1.Cells(var(lngRC), "C").Value
    Next lngRC
    
    
    ws1.Range("C7:C8").ClearContents
    ws1.Range("C10").ClearContents
    ws1.Range("C12:C15").ClearContents
    ws1.Range("C17:C19").ClearContents
    ws1.Range("C28:F47").ClearContents
    
    
    Set ws2 = Nothing
    Set ws1 = Nothing
    
    
    End Sub
    But I want to limit this code only works if cell C53 has some data. If cell C53 doesn't have any number, then a message: "You must fill in more data". If the cell C53 has number, then the code proceeds.

  2. #2
    VBAX Regular
    Joined
    Aug 2013
    Posts
    56
    Location
    Have already succeeded help me here: http://www.excelforum.com/excel-prog...ml#post3470840



    Cheers

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    To view that solution you need to join that particular forum. Since you raised the issue here as well then kindly post the solution so that others can easily follow the issue
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

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