+ Reply to Thread
Results 1 to 2 of 2

Macro for text file with different size

Hybrid View

  1. #1
    Registered User
    Join Date
    02-15-2006
    Posts
    2

    Macro for text file with different size

    I have to create a macro which consists on importing a text file and give some format. However the same text file can change its size. The problem I have is that after creating a macro for example with 20 rows, and I add more rows to the text file, if I run the macro again it will not recognize more than the 20 rows used originally to create the macro.

    How can I customize the macro to take the amount of rows that are present in the text every time I have to run it.

    Hope somebody can help me with this.

    Thanks in advance,
    Karolina

  2. #2
    Dave Peterson
    Guest

    Re: Macro for text file with different size

    Depends on what you're doing, but you could use:

    dim lastrow as long
    with activesheet
    lastrow = .cells(.rows.count,"A").end(xlup).row
    ' Then you can use that in your code:

    .range("a1:x" & lastrow).somethinghere

    end with




    Karolina wrote:
    >
    > I have to create a macro which consists on importing a text file and
    > give some format. However the same text file can change its size. The
    > problem I have is that after creating a macro for example with 20 rows,
    > and I add more rows to the text file, if I run the macro again it will
    > not recognize more than the 20 rows used originally to create the
    > macro.
    >
    > How can I customize the macro to take the amount of rows that are
    > present in the text every time I have to run it.
    >
    > Hope somebody can help me with this.
    >
    > Thanks in advance,
    > Karolina
    >
    > --
    > Karolina
    > ------------------------------------------------------------------------
    > Karolina's Profile: http://www.excelforum.com/member.php...o&userid=31600
    > View this thread: http://www.excelforum.com/showthread...hreadid=512902


    --

    Dave Peterson

+ 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