+ Post New Thread
Results 1 to 3 of 3
Coding Thread, Looping with range in VBA, help please in Coding and Web Development; Hello to everybody, I need help in writing this code I need for my final Thesis at University. I need ...
  1. #1

    Join Date
    Sep 2008
    Location
    Milan
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Looping with range in VBA, help please

    Hello to everybody,
    I need help in writing this code I need for my final Thesis at University.
    I need to extract cells from incremental ranges, (B3:C263), (D3:E263), ... , (ID3:IE263) and paste it to another sheet.
    The code I wrote (recorded) for the first extraction is:

    Range("D2").Select
    Windows("DATABASE.xlsx").Activate
    Range("B3").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range("B3:C263").Select
    Selection.Copy
    Windows("Calcolo implied vol OK.xlsm").Activate
    Range("G2").Select
    ActiveSheet.Paste
    Windows("DATABASE.xlsx").Activate
    ActiveWindow.SmallScroll Down:=-264
    Range("B1:C1").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Calcolo implied vol OK.xlsm").Activate
    Range("D2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("D2").Select
    Application.CutCopyMode = False
    Selection.AutoFill Destination:=Range("D2259")
    Range("D2259").Select
    ActiveWindow.SmallScroll Down:=-192

    Thanks in advance for your help, I appreciate.

    Francesco

  2. #2
    Scruff's Avatar
    Join Date
    May 2007
    Location
    Lincs
    Posts
    137
    Thank Post
    16
    Thanked 3 Times in 3 Posts
    Rep Power
    15
    whats the question ?

  3. #3

    Join Date
    May 2008
    Location
    Cheshire
    Posts
    288
    Thank Post
    48
    Thanked 27 Times in 24 Posts
    Rep Power
    18
    Hi iuppiter,

    due to it being a university project I won't feel right in telling you the 'answer' . Also I'm not sure I know what you mean. However, have you thought about using variables for example instead of using Range("B3").Select you would use a two global varibals like myCellInt and myCellStr. The int version will store the letter you are upto. Example:

    declare globally:
    Dim myCellStr As String
    Dim myCellInt As Integer

    Sub Macro1()
    'Previous cell was b4. myCellInt was 66 (ascii for B)
    myCellInt=myCellInt+1 'moving right one cell
    myCellStr = Chr(c) & "4" '4 being the row number
    'myCellStr will be now c4
    Range(test).Select
    End Sub


    Does this help with what you wanted?
    You'll obviously need to make some amendments. However, I hope this might be able to set you on your way
    Last edited by Pashers; 8th September 2008 at 03:58 PM.

SHARE:
+ Post New Thread

Similar Threads

  1. Novell looping XP!
    By googlemad in forum Windows
    Replies: 2
    Last Post: 4th June 2008, 01:43 PM
  2. Excel VBA Loop Question
    By vunsev in forum Coding
    Replies: 5
    Last Post: 11th April 2008, 08:08 AM
  3. Looping Builds on HP machines
    By ndavies in forum Network and Classroom Management
    Replies: 5
    Last Post: 20th November 2007, 03:42 PM
  4. Macro and VBA functions
    By randle in forum Windows
    Replies: 10
    Last Post: 9th February 2007, 09:32 AM
  5. Rebooting looping Win Xp Machines
    By nuttygeek in forum Windows
    Replies: 16
    Last Post: 8th February 2006, 07:30 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •