ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy from on eworkbook to another (https://www.excelbanter.com/excel-programming/407714-copy-eworkbook-another.html)

Karen53

Copy from on eworkbook to another
 
Hi,

I have two columns which copy to the new book rounded to the nearest dollar.
None of the other columns are doing this. It should be to 2 decimal places.

CAMDepMade is long

Sub NuSaveCAMDepMade(TenRow, CAMDepMade)

'Created 3/13/2008 by Karen Hoagland

Debug.Print "Starting NuSaveCAMDepMade " & Application.ScreenUpdating

With MainPagepg

'save CAM Deposits Made
With .Cells(TenRow, 14)
If CAMDepMade = 0 Then
.HorizontalAlignment = xlRight
.WrapText = False
.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(*
""-""??_);_(@_)"
.Value = CAMDepMade
End If

If .Value < CAMDepMade Then
.HorizontalAlignment = xlRight
.WrapText = False
.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(*
""-""??_);_(@_)"
.Value = CAMDepMade
End If
End With

End With

End Sub
--
Thanks for your help.
Karen53

Jim Thomlinson

Copy from on eworkbook to another
 
Without looking too closely you have declared
CAMDepMade is long
where long is a long integer. If you try to put a decimal into this variable
it will be automatically coereced to a whole number. Try changing the
delcaration to Double.
--
HTH...

Jim Thomlinson


"Karen53" wrote:

Hi,

I have two columns which copy to the new book rounded to the nearest dollar.
None of the other columns are doing this. It should be to 2 decimal places.

CAMDepMade is long

Sub NuSaveCAMDepMade(TenRow, CAMDepMade)

'Created 3/13/2008 by Karen Hoagland

Debug.Print "Starting NuSaveCAMDepMade " & Application.ScreenUpdating

With MainPagepg

'save CAM Deposits Made
With .Cells(TenRow, 14)
If CAMDepMade = 0 Then
.HorizontalAlignment = xlRight
.WrapText = False
.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(*
""-""??_);_(@_)"
.Value = CAMDepMade
End If

If .Value < CAMDepMade Then
.HorizontalAlignment = xlRight
.WrapText = False
.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(*
""-""??_);_(@_)"
.Value = CAMDepMade
End If
End With

End With

End Sub
--
Thanks for your help.
Karen53


Karen53

Copy from on eworkbook to another
 
Thank you, Jim
--
Thanks for your help.
Karen53


"Jim Thomlinson" wrote:

Without looking too closely you have declared
CAMDepMade is long
where long is a long integer. If you try to put a decimal into this variable
it will be automatically coereced to a whole number. Try changing the
delcaration to Double.
--
HTH...

Jim Thomlinson


"Karen53" wrote:

Hi,

I have two columns which copy to the new book rounded to the nearest dollar.
None of the other columns are doing this. It should be to 2 decimal places.

CAMDepMade is long

Sub NuSaveCAMDepMade(TenRow, CAMDepMade)

'Created 3/13/2008 by Karen Hoagland

Debug.Print "Starting NuSaveCAMDepMade " & Application.ScreenUpdating

With MainPagepg

'save CAM Deposits Made
With .Cells(TenRow, 14)
If CAMDepMade = 0 Then
.HorizontalAlignment = xlRight
.WrapText = False
.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(*
""-""??_);_(@_)"
.Value = CAMDepMade
End If

If .Value < CAMDepMade Then
.HorizontalAlignment = xlRight
.WrapText = False
.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(*
""-""??_);_(@_)"
.Value = CAMDepMade
End If
End With

End With

End Sub
--
Thanks for your help.
Karen53



All times are GMT +1. The time now is 10:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com