vba help please

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

vba help please

Postby shevek » Fri Nov 14, 2008 6:01 pm

hi,

i use the following code to paste the value of one cell into another when it is triggered...

lastrow = Target.Rows.Count
If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False
If Cells(3, 49) = 1 Then
Cells(3, 51) = Cells(3, 50)
Else
End If
Application.EnableEvents = True

instead of pasting to a target cell i want to paste to the next free space in a column...i.e. each time it is triggered it will paste the value from (3, 50) first to cell (3, 51) then (4, 51) then (5, 51) etc...

can anyone tell me how to modify the code please...

thanks
shevek
 
Posts: 14
Joined: Fri Aug 01, 2008 4:59 pm

Postby NorthView » Fri Nov 14, 2008 7:01 pm

You need to go to the bottom of the column and use an End(xlUp) to get a reference to the last non blank cell in the column, then use Offset(1,0) to refer to the next cell down. In Excel pre-2007 the maximum no of rows is 65536, in Excel 2007 it's 1048576, so in Excel 2003 putting the value of C1 into the first empty cell in Column C after the last non blank cell would like something like this:

Range("C65536").End(xlUp).Offset(1,0).Value = Range("C1").Value
NorthView
 
Posts: 174
Joined: Wed Oct 08, 2008 12:33 pm
Location: London

Postby shevek » Sat Nov 15, 2008 1:00 am

it works, thank you very much...

8)
shevek
 
Posts: 14
Joined: Fri Aug 01, 2008 4:59 pm


Return to Discussion

Who is online

Users browsing this forum: Bing [Bot] and 53 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.