Results 1 to 7 of 7

How does this VBA code work?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-08-2006
    Location
    UK
    MS-Off Ver
    2013
    Posts
    204

    Exclamation How does this VBA code work?

    Some kind soul provided me with this sample code which will populate a userform omitting rows where a cell is blank in column C (have attached the sheet).

    I'm trying to adapt it to a sheet where there are 22 columns (A - Q), and it is if a cell in column M is blank that the user form should show.

    Unfortunately I don't seem to understand the syntax of the code. I think the "Count, 3" bit is throwing me off.

    If someone could quickly explain it to me I'd be most appreciative.

    Private Sub UserForm_Initialize()
    Dim xCell As Range
    For Each cell In Range("C2", Cells(Rows.Count, 3).End(xlUp))
    If Not IsEmpty(cell) Then Me.CB_RefNo.AddItem cell.Offset(0, -2).Value
    Next
    
    End Sub
    Attached Files Attached Files
    Last edited by wonderdunder; 04-02-2012 at 11:46 AM.

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