Results 1 to 8 of 8

Userform to populate ONLY VISIBLE cells in a workbook (after a filter has been applied)

Threaded View

  1. #1
    Registered User
    Join Date
    11-15-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    41

    Userform to populate ONLY VISIBLE cells in a workbook (after a filter has been applied)

    Hi all,

    I have a excel doc with 2 userforms so that the workbook if filled out in 2 stages.

    Firstly the when someone books a meeting, they select the "caller" button and input the details of the meeting (from A to I). Then when the person takes the meeting (who may not be the same person who booked it), they select the "post appointment" button and fill out what happened in the meeting (in cells J to M).

    The problem is that the meetings will be entered before the earlier ones have occurred - so the second userform needs to input the details of that particular meeting next to the initial details that was entered earlier. Badly explained I know, but have a look at the doc attached and it will become clearer.

    So my idea to overcome this problem would be to use a filter to select the "date held" of today, open the second userform, enter in the details and populate the cells next to the details of this meeting. HOWEVER the userform is populating the hidden cells ie the first available empty row (starting from J. How to I specify that I want the second userform to populate ONLY VISIBLE CELLS?

    Here is the code for the second userform:

    Private Sub Label1_Click()
    
    End Sub
    
    Private Sub CommandButton3_Click()
    
    End Sub
    
    Private Sub cmdClear_Click()
    
        For Each ctl In Me.Controls
            If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
                ctl.Value = ""
            ElseIf TypeName(ctl) = "CheckBox" Then
                ctl.Value = False
        End If
    Next ctl
    
    End Sub
    
    Private Sub cmdExit_Click()
        Unload Me
    End Sub
    
    Private Sub cmdOK_Click()
    
    Dim iRow As Long
     Dim ws As Worksheet
     Set ws = Worksheets("Sheet1")
         
         iRow = ws.Range("J:M").Find(What:="*", SearchOrder:=xlRows, _
            SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
    
        RowCount = Worksheets("Sheet1").Range("J3").CurrentRegion.Rows.Count
        With Worksheets("Sheet1").Range("J3")
            ws.Cells(iRow, 10).Value = Me.txtPostContent.Value
            ws.Cells(iRow, 11).Value = Me.txtFollowUp.Value
            ws.Cells(iRow, 12).Value = DateValue(Me.txtdtDateFollow.Value)
            ws.Cells(iRow, 13).Value = Me.cboTracker.Value
    
        End With
           
        
        If Not IsDate(Me.txtdtDateFollow.Value) Then
                MsgBox "The Date booked box must contain a date.", vbExclamation, "Post Appointment Entry Form Error"
                Me.txtdtDateFollow.SetFocus
            Exit Sub
        End If
         
        If Me.cboTracker.Value = "" Then
            MsgBox "Please enter the initials of the person whom you would like to track this follow up.", vbExclamation, "Post Appointment Entry Form Error"
            Me.cboTracker.SetFocus
            Exit Sub
        End If
        
        If Me.txtFollowUp.Value = "" Then
            MsgBox "Please enter the follow up actions that are required.", vbExclamation, "Post Appointment Entry Form Error"
            Me.txtFollowUp.SetFocus
            Exit Sub
        End If
        
        If Me.txtPostContent.Value = "" Then
            MsgBox "Please enter in the content of the appointment. This should contain what the appointment was about/its purpose, what was demoed and how the appointment was received.", vbExclamation, "Post Appointment Entry Form Error"
            Me.txtPostContent.SetFocus
            Exit Sub
        End If
        
    End Sub


    I'd be really grateful for some help - I've been trying to solve this for ages and failing.

    Thanks!
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Filter worksheet data using 4 dependant comboboxes and populate in 'ListBox' on a userform
    By p_nayak268 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-27-2014, 12:41 PM
  2. Replies: 3
    Last Post: 06-28-2013, 10:30 AM
  3. Replies: 1
    Last Post: 05-09-2011, 03:19 PM
  4. Percentile function applied only to visible cells
    By bradleyverde in forum Excel General
    Replies: 0
    Last Post: 04-12-2010, 11:07 AM
  5. [SOLVED] Re: Get value from first visible row after AutoFilter applied?
    By jg70124 in forum Excel General
    Replies: 0
    Last Post: 04-07-2006, 06:25 PM

Tags for this Thread

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