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 ...
-
5th September 2008, 05:25 PM #1
- 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("D2
259")
Range("D2
259").Select
ActiveWindow.SmallScroll Down:=-192
Thanks in advance for your help, I appreciate.
Francesco
-
-
IDG Tech News
-
8th September 2008, 01:32 PM #2
-
-
8th September 2008, 03:47 PM #3
- Rep Power
- 11
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:
Similar Threads
-
By googlemad in forum Windows
Replies: 2
Last Post: 4th June 2008, 01:43 PM
-
By vunsev in forum Coding
Replies: 5
Last Post: 11th April 2008, 08:08 AM
-
By ndavies in forum Network and Classroom Management
Replies: 5
Last Post: 20th November 2007, 04:42 PM
-
By randle in forum Windows
Replies: 10
Last Post: 9th February 2007, 10:32 AM
-
By nuttygeek in forum Windows
Replies: 16
Last Post: 8th February 2006, 08: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
-
Forum Rules