VBA - Copy raw data as decimal number

Please post any questions regarding the program here.

Moderator: 2020vision

VBA - Copy raw data as decimal number

Postby excelhasey » Sat Mar 08, 2014 8:43 pm

I am trying to copy data (in number format) which are populated from another worksheet and change regularly but I want to copy this data to another cell - When I use the VBA code below it does copy the data from the cells i.e. from Col G to Col B but when you click on cell B3 you see the number (lets say 1.86) in the cell but the cell has also copied the formula over from cell G3 - I don't want this I just want the raw output data i.e. 1.86

Am I close or miles away ?? (Its the Dim Variant isn't it ??)

Option Explicit

Dim copymydata As Variant

Private Sub copymydata()

If [G3] >= 0 Then

Range("G3:G2000").Copy Range("B3:B2000")

End If

End Sub
excelhasey
 
Posts: 196
Joined: Sat May 22, 2010 4:57 pm
Location: North West

Re: VBA - Copy raw data as decimal number

Postby MiniBlueDragon » Sun Mar 09, 2014 10:16 am

I think it needs to be a PasteSpecial?

excelhasey wrote:Option Explicit

Dim copymydata As Variant

Private Sub copymydata()

If [G3] >= 0 Then

Set rng = Range("G3:G2000")
rng.Copy
Range("B3:B2000").PasteSpecial (xlPasteValues)

End If

End Sub


That work for you?
MiniBlueDragon
 
Posts: 130
Joined: Tue Jul 05, 2011 1:14 pm
Location: London

Postby Captain Sensible » Sun Mar 09, 2014 1:28 pm

I always just use something like this and it just copies the value in the cell rather than any formulas

Sheet2.Range("I5").Value = Sheet1.Range("Q2").Value
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Postby Captain Sensible » Sun Mar 09, 2014 1:32 pm

Private Sub copymydata()

If [G3] >= 0 Then

Range("B3:B2000").Value = Range("G3:G2000").Value

End If

End Sub
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Postby excelhasey » Sun Mar 16, 2014 4:26 pm

Thanks lads cant get t to work on this tab in VBA I already have

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

So MiniBlueDragon & Captain Sensible how do I integrate your code ??

Thanks
excelhasey
 
Posts: 196
Joined: Sat May 22, 2010 4:57 pm
Location: North West


Return to Help

Who is online

Users browsing this forum: Google [Bot] and 46 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.