Moving a decimal VBA

Lukums

Board Regular
Joined
Nov 23, 2015
Messages
195
G'day guys.

Need to do a tricky one...

I'm not sure how this can be done with a VBA sub routine. Once the data shifts to another sheet ("DATA Currently") I need to run a VBA script afterwards to convert it into the "Data needs to be" values.

Anyone got ideas? I'm sure there would be a way

Data CurrentlyData needs to be
30003.0
1152011.520
9820.982
31003.1
72117.211
84008.4
41224.122

<tbody>
</tbody>


Cheers for your help again guys.

Luke
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
How does the data "shift to another sheet"? What range does it come from, what range does it go to, is it copied or moved, and how do you do it?

How much of this process is manual and how much do you want in VBA?

Shifting the decimal point is trivial; you just divide by 1000.
 
Upvote 0
How does the data "shift to another sheet"? What range does it come from, what range does it go to, is it copied or moved, and how do you do it?

How much of this process is manual and how much do you want in VBA?

Shifting the decimal point is trivial; you just divide by 1000.

Hey mate,

All the shifting - ranges is all done (that stuff is sorted).

The data is all copied into for example: Sheet1 Starting in A1 Column. What I want to do in VBA is look at "A" and then do the /1000 and somehow handle the 3000/4000/5000 values to 5.0 (with a decimal) not just a 3/4/5 outcome.

It's not trivial as /1000 won't give you 3.0 it will give you 3 unless I'm missing something here. For the majority 100% it works fine.
But for the 3000/4000/5000 etc is the issue mainly.

Appreciate the help!
 
Upvote 0
So everything in column "A" needs to stay in Column "A" ??....or a new column ??
 
Upvote 0
So everything in column "A" needs to stay in Column "A" ??....or a new column ??

Same column is fine. But if a helper column is required that's fine too.

For exmaple: This works...

If Sheets("Sheet1").Range("B1").Value = 3 Then

Sheets("Sheet1").Range("B1").Select

Selection.NumberFormat = "0.0"

So that said I think all I need is to sift through i to LASTROW to find these types of values and then decimal place backwards.
 
Upvote 0
You can put 1000 in a spare cell, copy it and then do a paste special with xlOperation
Code:
With Cells(1, Columns.Count)
    .Value = 1000
    .Copy
    .Range("A1:A1000").PasteSpecial xlOperation:=xlPasteSpecialOperationDivide
    .EntireColumn.Delete
End With

.Range("A1:A1000").NumberFormat = "0.0"
 
Upvote 0
maybe something like
Code:
With Range("A1").CurrentRegion.Columns(1) 'change to suit
    .Value = Evaluate(.Address & "/1000")
    .NumberFormat = "#,##0.0"
End With
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,238
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top