+ Reply to Thread
Results 1 to 5 of 5

Alphabetic loop

  1. #1
    Registered User
    Join Date
    01-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Alphabetic loop

    I'm new to programing in excel and VB and was hoping someone could help we with this problem i'm facing. I'm trying to perform a fourier transform across over 6000 columns! I can do this for one column at a time using:

    Sub fft()
    '
    ' fft Macro
    ' fft
    '
    ' Keyboard Shortcut: Ctrl+f
    '
    Application.Run "ATPVBAEN.XLAM!Fourier", Sheet2.Range("A$1:A$512"), Sheet3.Range("A$1:A$512"), False, False

    End Sub

    This works well for one column however i can't find a way of looping the column letter so that the operation repeats up to column IAV (ie. A B C ... IAV). Any help would be appreciated!

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,330

    Re: Alphabetic loop

    Hi Bgeophysics and welcome to the forum.

    There are two ways to program around this:
    1 Use Cells(Rows,Columns) instead of Range as the Rows is a number.
    2 Use Offsets after your Range

    See http://www.excel-vba.com/vba-code-2-6-cells-ranges.htm - this guy doesn't like cells, but I do.
    Or http://www.anthony-vba.kefra.com/vba/vbabasic2.htm where s/he shows how they relate.

    You will use the rows as a variable and increment it in the Cells(rows, columns) or Range(,).Offset(Rows,) commands.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    01-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Alphabetic loop

    MarvinP

    I appreciate your response. I'm still having issues and i attribute this to my lack of programming knowledge. I cannot loop the FFT application across columns.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Alphabetic loop

    To illustrate Marvin's first suggestion:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Alphabetic loop

    StephenR,
    Thanks so much that worked great!

+ 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