+ Reply to Thread
Results 1 to 4 of 4

Sample code for a userform

  1. #1
    Registered User
    Join Date
    01-28-2012
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    5

    Sample code for a userform

    I have a userform with a textfield (DtPurchased) and 1 button (receivedAT).
    I have 1 sheet (Stores) with 50 already populated columns (store names).
    I have a sheet (HDay) with 10 already populated columns (Holidays)

    I have 1 printStoreIventory button and a textfield (store name) which receives a store name and prints all dates when a car was received.

    how do I get a printCompInventory button to print a calendar with the store that received a car that day?

    how do I get my button to output in a message which stores received a car on the date I entered in my text field?

    Any help will be appreciated...
    Last edited by condor; 01-28-2012 at 09:02 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Sample code for a userform

    Attach what you have so far
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    01-28-2012
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Sample code for a userform

    Roy,
    I found a code you wrote in 2010 (see below)and it's very close to what I'm looking for. I, however, am very new to VBA and although I have tried to modify your code to fit my needs I have come up empty. Can you assist? I want to get the data on Sheet1 arranged on Sheet2 in a specific way.

    Option Explicit

    Sub x()
    Dim rCl As Range
    Dim rSearch As Range
    Dim rFound As Range
    Dim sFind As String
    Dim sFirstAddress As String

    With Sheet1
    Set rSearch = .Range(.Cells(2, 5), .Cells(.Rows.Count, 5).End(xlUp))
    sFind = InputBox("Enter a value to find")
    If sFind = Empty Then Exit Sub
    Set rCl = rSearch.Find(sFind, LookIn:=xlValues)
    If Not rCl Is Nothing Then
    sFirstAddress = rCl.Address
    Do
    If rFound Is Nothing Then
    Set rFound = rCl.EntireRow.Resize(1, .Columns.Count)
    Else: Set rFound = Union(rFound, rCl.EntireRow.Resize(1, .Columns.Count))
    End If
    Set rCl = rSearch.FindNext(rCl)
    Loop While Not rCl Is Nothing And rCl.Address <> sFirstAddress
    End If
    End With
    With Sheet2
    rFound.Copy .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0)
    End With
    End Sub
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Sample code for a userform

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

+ Reply to Thread

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