+ Reply to Thread
Results 1 to 2 of 2

Trying to write text file to worksheet with VBA

  1. #1
    Registered User
    Join Date
    01-22-2009
    Location
    Madison, Wisconsin
    MS-Off Ver
    Excel 2003
    Posts
    4

    Trying to write text file to worksheet with VBA

    I am reading a Report text file, pasring 8 fields and then want to write those to the worksheet starting with row=5, Col=A through H.
    I have the reading and field parsing working but the write to Excel starts in Row 9...it does put the fields in A-H.
    This is what I have.
    nTgtRow = 5
    Set rngRef = Worksheets("Sheet2").Cells(nTgtRow, 1)
    Then in my read text file loop.
    rngRef.Cells(nTgtRow, 1) = strAcct
    rngRef.Cells(nTgtRow, 2) = strJobnum
    rngRef.Cells(nTgtRow, 3) = strPagenum
    rngRef.Cells(nTgtRow, 4) = strHrsDebit
    rngRef.Cells(nTgtRow, 5) = strCostDebit
    rngRef.Cells(nTgtRow, 6) = strHrsCredit
    rngRef.Cells(nTgtRow, 7) = strHrsDebit
    rngRef.Cells(nTgtRow, 8) = strCostCat
    nTgtRow = nTgtRow + 1
    Any help is appreciated.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Trying to write text file to worksheet with VBA

    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
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

+ 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