OZmium Sports Betting and Horse Racing Forums

OZmium Sports Betting and Horse Racing Forums (http://forums.ozmium.com.au/index.php)
-   General Topics (http://forums.ozmium.com.au/forumdisplay.php?f=59)
-   -   Excel Macro Help Please (http://forums.ozmium.com.au/showthread.php?t=23761)

moeee 5th April 2012 08:36 AM

Excel Macro Help Please
 
882 938 0 0 0 982
918 0 0 0 0 982
246 339 421 542 697 983
258 319 399 490 790 983
471 546 635 743 872 983

These are Row examples of Columns B to G
I need a Macro that will copy and paste (Special,Values) C to G onto positions B to F
But only if F is greater than zero
I have perhaps 2000 Rows that need doing

I need a Macro that will save me manually doing this task.

Shaun 5th April 2012 10:27 AM

I am confused, it looks like you want to copy an item then paste over the top of the same item.

Do you want this to copy the items one by one after looking to see if particular data equals zero?

moeee 5th April 2012 01:31 PM

Hi Shaun
Thanks for your interest.

What I have is the past 5 runs of an animal with the oldest run in Column B and the latest run in Column F
As this animal has a new run , I need to introduce this new run and eliminate the run 6 starts back.

So in the Worksheet , I need to move all the figures in a row , 1 to the left.
If the animal only has 4 or less runs , then I dont wish to do that.


EDIT:
The Manual version of what I do is I look to see if the Cell in Column F is more than zero.
If it is , then I select Cells C to G , and copy and paste them over the top of Cells B to F.

Shaun 5th April 2012 03:08 PM

any chance you could post the sheet?

moeee 5th April 2012 03:26 PM

I try

moeee 5th April 2012 03:31 PM

xls file attachment
 
1 Attachment(s)
try this

EDIT : And as a New Meeting has concluded , I will fill in the appropriate Numbers into Column G and then do the Macro that I ain't got but at the moment I do it manually.

Shaun 6th April 2012 11:20 AM

i had a look and not sure a macro would do it, reason being that is a data base so unless they all ran at the same time i can't see a way to work out what runners need updating and what don't.

moeee 6th April 2012 11:32 AM

Seems your not getting it Shaun.

Picture this.

The Sheet I posted is actually a physical sheet of paper.
At the end of the day I need to add a new set of figures to Column G.
Some Cells will have numbers and some will remain blank.
If a Row now has 6 numbers next to its name , I need to make it only 5 , and this is accomplished by clearing Cell B and transferring all the numbers across to the left.
So B will now hold the previous C , and C will hold the previous D and so on.

If the Row does not have 6 numbers , I leave that Row alone.


EDIT:
I stated in earler Post that this happens when a Meeting has concluded.
This is where I messed up and got you into trouble.
It should be when the "Day" has Concluded.
I do this so the Sheet will updated and be ready for tomorrows Studies.

moeee 6th April 2012 11:45 AM

This I haven't tried , but is pretty much what I want happening

Sub Macro1()

SELECT.SHEET = "DATABASE"

FOR SELECTION = 1 TO 2000
IF CELL (SELECTION,F) = 0 THEN

Range("C17:G17").Select
Selection.Cut
Application.CutCopyMode = False
Selection.Copy
Range("B17").Select
ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False, _
IconFileName:=False
END IF
NEXT SELECTION

End Sub

norisk 6th April 2012 12:13 PM

moeee, maybe an easier approach would be record a macro while creating a set of formulas in say columns K to P which duplicate the figures in B to G but only bring across the last 5 runs, & then copy/paste special/values columns K to P over B to G.

Shouldnt be too hard to do, formula would be something like if(G<>"",G, if F<>"",F, & so on


All times are GMT +10. The time now is 08:54 PM.

Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.