Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default PLEASE HELP MACRO NEEDED

Please see the post below

http://groups.google.co.uk/group/mic...faf5664?hl=en#

if anybody cannot understand my question in above post please see my
excel sheet which i have uploaded on "savefile.com" and put the link
below to see that file. i have explained more clearly what i want.
Please please if anybody can help

FILE LINK (see below)

http://www.savefile.com/files/1521549
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default PLEASE HELP MACRO NEEDED

On 24 Apr, 22:13, K wrote:
Please see the post below

http://groups.google.co.uk/group/mic....programming/b...

if anybody cannot understand my question in above post please see my
excel sheet which i have uploaded on "savefile.com" and put the link
below to see that file. i have explained more clearly what i want.
Please please if anybody can help

FILE LINK (see below)

http://www.savefile.com/files/1521549


Phillip London UK

This works for me
Paste the following code into a standard module

Sub DoReport()
DoCalcs Sheet1.Range("A3:A14"), "GX", Sheet2.Range("B1"), False
DoCalcs Sheet1.Range("B3:B14"), "GT", Sheet2.Range("B2"), True
End Sub

Private Sub DoCalcs(Rg As Range, Cde As String, Multi As Long, flag As
Boolean)
Dim cl As Range
Dim startcell As Range
Dim total As Long
Dim roundamount As Long
Dim adjust As Long
Dim curcell As Range
Static oset As Long
Set startcell = Sheet3.Range("A2")
For Each cl In Rg
startcell.Offset(oset, 0).Value = Cde
roundamount = WorksheetFunction.Round((cl.Value / 100) *
Multi, 0)
startcell.Offset(oset, 1).Value = roundamount
If roundamount = 1 Then
Set curcell = startcell.Offset(oset, 1)
End If
oset = oset + 1
total = total + roundamount
Next
adjust = Multi - total
curcell.Value = curcell.Value + adjust
If flag Then oset = 0
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default PLEASE HELP MACRO NEEDED

On 26 Apr, 02:15, Phillip wrote:
On 24 Apr, 22:13, K wrote:

Please see the post below


http://groups.google.co.uk/group/mic....programming/b...


if anybody cannot understand my question in above post please see my
excel sheet which i have uploaded on "savefile.com" and put the link
below to see that file. i have explained more clearly what i want.
Please please if anybody can help


FILE LINK (see below)


http://www.savefile.com/files/1521549


Phillip London UK

This works for me
Paste the following code into a standard module

Sub DoReport()
* * DoCalcs Sheet1.Range("A3:A14"), "GX", Sheet2.Range("B1"), False
* * DoCalcs Sheet1.Range("B3:B14"), "GT", Sheet2.Range("B2"), True
End Sub

Private Sub DoCalcs(Rg As Range, Cde As String, Multi As Long, flag As
Boolean)
* * Dim cl As Range
* * Dim startcell As Range
* * Dim total As Long
* * Dim roundamount As Long
* * Dim adjust As Long
* * Dim curcell As Range
* * Static oset As Long
* * Set startcell = Sheet3.Range("A2")
* * For Each cl In Rg
* * * * startcell.Offset(oset, 0).Value = Cde
* * * * roundamount = WorksheetFunction.Round((cl.Value / 100) *
Multi, 0)
* * * * startcell.Offset(oset, 1).Value = roundamount
* * * * If roundamount = 1 Then
* * * * Set curcell = startcell.Offset(oset, 1)
* * * * End If
* * * * oset = oset + 1
* * * * total = total + roundamount
* * Next
* * adjust = Multi - total
* * curcell.Value = curcell.Value + adjust
* * If flag Then oset = 0
End Sub


Thanks Philip for replying. i havnt tried your macro yet but i'll go
to office on Monday and will try your code and let you know if i have
any question. Thanks again
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default PLEASE HELP MACRO NEEDED

On 27 Apr, 10:30, K wrote:
On 26 Apr, 02:15, Phillip wrote:





On 24 Apr, 22:13, K wrote:


Please see the post below


http://groups.google.co.uk/group/mic....programming/b....


if anybody cannot understand my question in above post please see my
excel sheet which i have uploaded on "savefile.com" and put the link
below to see that file. i have explained more clearly what i want.
Please please if anybody can help


FILE LINK (see below)


http://www.savefile.com/files/1521549


Phillip London UK


This works for me
Paste the following code into a standard module


Sub DoReport()
* * DoCalcs Sheet1.Range("A3:A14"), "GX", Sheet2.Range("B1"), False
* * DoCalcs Sheet1.Range("B3:B14"), "GT", Sheet2.Range("B2"), True
End Sub


Private Sub DoCalcs(Rg As Range, Cde As String, Multi As Long, flag As
Boolean)
* * Dim cl As Range
* * Dim startcell As Range
* * Dim total As Long
* * Dim roundamount As Long
* * Dim adjust As Long
* * Dim curcell As Range
* * Static oset As Long
* * Set startcell = Sheet3.Range("A2")
* * For Each cl In Rg
* * * * startcell.Offset(oset, 0).Value = Cde
* * * * roundamount = WorksheetFunction.Round((cl.Value / 100) *
Multi, 0)
* * * * startcell.Offset(oset, 1).Value = roundamount
* * * * If roundamount = 1 Then
* * * * Set curcell = startcell.Offset(oset, 1)
* * * * End If
* * * * oset = oset + 1
* * * * total = total + roundamount
* * Next
* * adjust = Multi - total
* * curcell.Value = curcell.Value + adjust
* * If flag Then oset = 0
End Sub


Thanks Philip for replying. *i havnt tried your macro yet but i'll go
to office on Monday and will try your code and let you know if i have
any question. *Thanks again- Hide quoted text -

- Show quoted text -


Thanks man it works superb
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help Needed sb1920alk Excel Discussion (Misc queries) 0 December 7th 07 09:54 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro needed to set macro security in Excel to minimum Carl Excel Programming 3 March 18th 06 03:36 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 09:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"