Results 1 to 3 of 3

SOLVED excel form button question

Threaded View

  1. #1
    Registered User
    Join Date
    09-04-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    25

    SOLVED excel form button question

    I have this working sub that reads a file and display them when I clicked a button on the form. However, the information doesn't appear immediately after I clicked the button. I will need to close the form for the data to be displayed in A:
    Private Sub CommandButton2_Click()
    Dim iRow As Long
    Dim ws As Worksheet
    Dim sFileName As String
    Dim FileText$
    Set ws = Worksheets("SL")
    sFileName = "C:\SL.txt"
    If Dir(sFileName) <> Empty Then
    Application.ScreenUpdating = False
    Open (sFileName) For Input As #1
    N = 1
    Do While Not EOF(1)
    Input #1, FileText
    ws.Cells(N, "A") = FileText
    N = N + 1
    Loop
    Close #1
    End If
    End Sub
    Last edited by zigzag; 10-22-2011 at 09:23 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