Results 1 to 4 of 4

Programming a confirm overwrite message box

Threaded View

  1. #1
    Registered User
    Join Date
    04-04-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    Cool Programming a confirm overwrite message box

    Hello all,

    This is my first post and I apologise if it's in the wrong place.

    I have created a user form that allows various choices to be checked, which are then put into a cell in the spreadsheet.

    However, I want a 'confirm overwrite? (yes/no)' message to be displayed if there is data already in the cell - clicking yes proceeds to overwrite and clicking no aborts the overwrite procedure.

    Here is the code I already have, which is assigned to the OK box:
    Private Sub CommandButton6_Click()
    
    Dim ws As Worksheet
    Set ws = Worksheets("Sheet1")
    
    Dim str As String
    
    For Each ctr In Me.Controls
    
    If (ctr) Then
        str = str + ctr.Caption + ", "
        End If
        
    Next ctr
    
    'ActiveCell
    
    ws.Cells(ActiveCell.Row, 9).Value = str
    
    Unload Me
    
    End Sub
    Any help is much appreciated.
    Last edited by Paul; 04-04-2012 at 01:02 PM. Reason: Added CODE tags for new user. Please do so yourself in the future.

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