Format Active Cells

S.H.A.D.O.

Well-known Member
Joined
Sep 6, 2005
Messages
1,915
Hi everyone,

How can I format the following please :-

Code:
Worksheets("Test").Select 
With ActiveCell 
  .Offset(1, 0).Value = cmb & " If " & pik <- Format Right 
  .Offset(1, 1).Value = Tested <- Accept Thousands & NO Decimal Places 
  .Offset(1, 2).Value = tly <- Accept Thousands & NO Decimal Places 
  .Offset(1, 3).Value = 100 / Tested * tly <- 5 Decimal Places 
  .Offset(1, 4).Value = Tested - tly <- Accept Thousands & NO Decimal Places 
  .Offset(1, 5).Value = (100 / Tested) * (Tested - tly) <- 5 Decimal Places 
  .Offset(1, 6).Value = tly + Tested - tly <-  Accept Thousands & NO Decimal Places 
  .Offset(1, 7).Value = (100 / Tested * tly) + ((100 / Tested) * (Tested - tly)) <- General & NO Decimal Places 
    .Offset(1, 0).Select 
End With
Thanks in Advance.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Is this what you mean?
Code:
With ActiveCell
    .Offset(1, 0).Value = cmb & " If " & pik
    .Offset(1, 0).HorizontalAlignment = xlRight
    .Offset(1, 1).Value = tested
    .Offset(1, 1).NumberFormat = "#0"
    .Offset(1, 2).Value = tly
    .Offset(1, 2).NumberFormat = "#0"
    .Offset(1, 3).Value = 100 / tested * tly
    .Offset(1, 3).NumberFormat = "#0.00000"
    .Offset(1, 4).Value = tested - tly
    .Offset(1, 4).NumberFormat = "#0"
    .Offset(1, 5).Value = (100 / tested) * (tested - tly)
    .Offset(1, 5).NumberFormat = "#0.00000"
    .Offset(1, 6).Value = tly + tested - tly
    .Offset(1, 6).NumberFormat = "#0"
    .Offset(1, 7).Value = (100 / tested * tly) + ((100 / tested) * (tested - tly))
    .Offset(1, 7).NumberFormat = "#"
    .Offset(1, 0).Select
End With
 
Upvote 0
Thanks Lewiy, that is EXACTLY what I was after.
What about if I wanted to format ...

Code:
.Offset(0, 0).Value = "For 1 - " & POOL & " there are " & tly & " different set of " &  cmb & " numbers. "
... as "#,##0" for the tly output please?.

Thanks in Advance.
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,887
Members
449,057
Latest member
Moo4247

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