PC Review


Reply
Thread Tools Rate Thread

Adjusting code to loop

 
 
Wopper
Guest
Posts: n/a
 
      6th Jun 2007
Hi all,

I need a little help with a code I use that I want to loop.
I get a file every day and the lenght of it is different each time.
So that's why there should be a loop to get all date.

Bellow is the code I'm using and that needs to be looped! (so also
line
2, 3 etc if they are there)

Also the output should not overwrite itself in the MEU sheet.


Please show me what to do.
Thanks


'Autofilter on cash that comes in
Sheets("Settled trades").Select
Rows("1:1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="=IN", Operator:=xlAnd


'Place the right values in the Booking CASH in (Settled) sheet
for
MEU
Sheets("Settled trades").Select
Range("H2").Select
Selection.Copy
Sheets("Booking CASH in (Settled)").Select
Range("B4:B5,B8:B9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Settled trades").Select
Range("I2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Booking CASH in (Settled)").Select
Range("J2:J9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Settled trades").Select
Range("D2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Booking CASH in (Settled)").Select
Range("K2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Calculate
Sheets("Settled trades").Select
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Booking CASH in (Settled)").Select
Range("L6:M9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Settled trades").Select
Range("G2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Booking CASH in (Settled)").Select
Range("L2:M5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("N2").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(""OMR"",Settled trades!
RC[-13])"
Apllication.CutCopyMode = False
Selection.Copy
Range("N3:N9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("O2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Part fails"
Range("O2").Select
Selection.Copy
Range("O3:O9").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A2:X9").Select
Selection.Copy


'Place booking in MEU sheet
Windows("MEU.xls").Activate
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

 
Reply With Quote
 
 
 
 
Bernie Deitrick
Guest
Posts: n/a
 
      6th Jun 2007
Wopper,

It would be better if you posted a description of what you want to do.

HTH,
Bernie
MS Excel MVP


"Wopper" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all,
>
> I need a little help with a code I use that I want to loop.
> I get a file every day and the lenght of it is different each time.
> So that's why there should be a loop to get all date.
>
> Bellow is the code I'm using and that needs to be looped! (so also
> line
> 2, 3 etc if they are there)
>
> Also the output should not overwrite itself in the MEU sheet.
>
>
> Please show me what to do.
> Thanks
>
>
> 'Autofilter on cash that comes in
> Sheets("Settled trades").Select
> Rows("1:1").Select
> Selection.AutoFilter
> Selection.AutoFilter Field:=3, Criteria1:="=IN", Operator:=xlAnd
>
>
> 'Place the right values in the Booking CASH in (Settled) sheet
> for
> MEU
> Sheets("Settled trades").Select
> Range("H2").Select
> Selection.Copy
> Sheets("Booking CASH in (Settled)").Select
> Range("B4:B5,B8:B9").Select
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks _
> :=False, Transpose:=False
> Sheets("Settled trades").Select
> Range("I2").Select
> Application.CutCopyMode = False
> Selection.Copy
> Sheets("Booking CASH in (Settled)").Select
> Range("J2:J9").Select
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks _
> :=False, Transpose:=False
> Sheets("Settled trades").Select
> Range("D2").Select
> Application.CutCopyMode = False
> Selection.Copy
> Sheets("Booking CASH in (Settled)").Select
> Range("K2").Select
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks _
> :=False, Transpose:=False
> Calculate
> Sheets("Settled trades").Select
> Range("B2").Select
> Application.CutCopyMode = False
> Selection.Copy
> Sheets("Booking CASH in (Settled)").Select
> Range("L6:M9").Select
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks _
> :=False, Transpose:=False
> Sheets("Settled trades").Select
> Range("G2").Select
> Application.CutCopyMode = False
> Selection.Copy
> Sheets("Booking CASH in (Settled)").Select
> Range("L2:M5").Select
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks _
> :=False, Transpose:=False
> Range("N2").Select
> ActiveCell.FormulaR1C1 = "=CONCATENATE(""OMR"",Settled trades!
> RC[-13])"
> Apllication.CutCopyMode = False
> Selection.Copy
> Range("N3:N9").Select
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks _
> :=False, Transpose:=False
> Range("O2").Select
> Application.CutCopyMode = False
> ActiveCell.FormulaR1C1 = "Part fails"
> Range("O2").Select
> Selection.Copy
> Range("O3:O9").Select
> ActiveSheet.Paste
> Application.CutCopyMode = False
> Range("A2:X9").Select
> Selection.Copy
>
>
> 'Place booking in MEU sheet
> Windows("MEU.xls").Activate
> Range("A3").Select
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks _
> :=False, Transpose:=False
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
adjusting screen contrast through C# code programmatically u0k0 Windows XP 0 21st Jul 2011 12:09 PM
Help adjusting code to examine whole account groups first =?Utf-8?B?ZWRsdXZlcg==?= Microsoft Excel Programming 1 28th Mar 2007 04:13 AM
Adjusting the size of a subform using code =?Utf-8?B?Q3JhaWc=?= Microsoft Access Form Coding 1 24th Jul 2005 11:15 PM
Need help adjusting my code: HouseofRahl Microsoft Excel Programming 1 12th Jul 2005 10:53 PM
Adjusting VBA code for some flexibility adidas VBA Microsoft Excel Programming 7 30th Nov 2003 03:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:13 AM.