ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   format in macro (https://www.excelbanter.com/excel-discussion-misc-queries/123245-format-macro.html)

brian thompson3001 via OfficeKB.com

format in macro
 
Hi

this time with the coding

I am using the below code that I got off this forum. All works to my
requirements, except, in cell L31 on all of my sheets in the workbook shows
the value as a percentage, e.g. 31.16%
When runing the macro, I get the value in the summary sheet as 0.311615
Q. What alteration is required to the code and where abouts it be placed to
show the correct format?
I am not a code writer, nor understand them and only get by with copy and
paste, and therefore any help would be appriciated

thanks in advance

Sub Summary()
Dim ws As Worksheet
Dim i As Integer
i = 2
Sheets(1).Activate
Sheets.Add
With Sheets(1)
.Range("A1").Value = "Week"
.Range("B1").Value = "Released"
.Range("C1").Value = "Delivered"
.Range("D1").Value = "Del Late"
.Range("E1").Value = "Performance"
For Each ws In ThisWorkbook.Worksheets
If ws.Index < 1 Then
.Rows(i).Cells(1).Value = ws.Name
.Rows(i).Cells(2).Value = ws.Range("L30")
.Rows(i).Cells(3).Value = ws.Range("L27")
.Rows(i).Cells(4).Value = ws.Range("L29")
.Rows(i).Cells(5).Value = ws.Range("L31")
i = i + 1
End If
Next
End With
End Sub

Brian

--
bnt

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1


Bob Phillips

format in macro
 
Responded in other thread.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"brian thompson3001 via OfficeKB.com" <u15682@uwe wrote in message
news:6b0a507310fc1@uwe...
Hi

this time with the coding

I am using the below code that I got off this forum. All works to my
requirements, except, in cell L31 on all of my sheets in the workbook
shows
the value as a percentage, e.g. 31.16%
When runing the macro, I get the value in the summary sheet as 0.311615
Q. What alteration is required to the code and where abouts it be placed
to
show the correct format?
I am not a code writer, nor understand them and only get by with copy and
paste, and therefore any help would be appriciated

thanks in advance

Sub Summary()
Dim ws As Worksheet
Dim i As Integer
i = 2
Sheets(1).Activate
Sheets.Add
With Sheets(1)
.Range("A1").Value = "Week"
.Range("B1").Value = "Released"
.Range("C1").Value = "Delivered"
.Range("D1").Value = "Del Late"
.Range("E1").Value = "Performance"
For Each ws In ThisWorkbook.Worksheets
If ws.Index < 1 Then
.Rows(i).Cells(1).Value = ws.Name
.Rows(i).Cells(2).Value = ws.Range("L30")
.Rows(i).Cells(3).Value = ws.Range("L27")
.Rows(i).Cells(4).Value = ws.Range("L29")
.Rows(i).Cells(5).Value = ws.Range("L31")
i = i + 1
End If
Next
End With
End Sub

Brian

--
bnt

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1





All times are GMT +1. The time now is 07:59 PM.

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