Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Can this macro be made to work upside down?

Hi there, the code below works out the amount of rows on each sheet
and
divides it up percentage(wise) working from the top of the sheet,
starting
at 0% right down to the bottom of the used rows, ending at 100% on
each
range for each sheet...my question is:
Can this be turned upside down without using a 'sort' macro as it is
already sorted before the %ages are added..
So the top of the sheet/range is 100% and the bottom is 0%...

Thanks for any help anyone can give...cheers, ste

Sub getdepth()

Application.ScreenUpdating = False

For sheetNumber = 1 To 56

SheetName = "S" & Format(sheetNumber, "##0")
Sheets(SheetName).Select

xlrow = 3

Do While Not (ActiveSheet.Cells(xlrow, 1).Value = "")

ActiveSheet.Cells(xlrow, 10).Value = Format((xlrow /
ActiveSheet.Cells(1, 2).Value), "#0.0%")

xlrow = xlrow + 1

Application.StatusBar = "System Status: " & Format(xlrow
/ ActiveSheet.Cells(1, 2), "00%") & " of Depth %age for " & SheetName
& " have been built..."

Loop

Next

Application.StatusBar = False

Sheets("Selection").Select

checksystem_forblanks

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Can this macro be made to work upside down?

Mac,

Calculate the last row of data

Cells(Rows.Count,"A").End(xlUp).Row

and then run the lop backwards from that value to row 3

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ste mac" wrote in message
om...
Hi there, the code below works out the amount of rows on each sheet
and
divides it up percentage(wise) working from the top of the sheet,
starting
at 0% right down to the bottom of the used rows, ending at 100% on
each
range for each sheet...my question is:
Can this be turned upside down without using a 'sort' macro as it is
already sorted before the %ages are added..
So the top of the sheet/range is 100% and the bottom is 0%...

Thanks for any help anyone can give...cheers, ste

Sub getdepth()

Application.ScreenUpdating = False

For sheetNumber = 1 To 56

SheetName = "S" & Format(sheetNumber, "##0")
Sheets(SheetName).Select

xlrow = 3

Do While Not (ActiveSheet.Cells(xlrow, 1).Value = "")

ActiveSheet.Cells(xlrow, 10).Value = Format((xlrow /
ActiveSheet.Cells(1, 2).Value), "#0.0%")

xlrow = xlrow + 1

Application.StatusBar = "System Status: " & Format(xlrow
/ ActiveSheet.Cells(1, 2), "00%") & " of Depth %age for " & SheetName
& " have been built..."

Loop

Next

Application.StatusBar = False

Sheets("Selection").Select

checksystem_forblanks

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Can this macro be made to work upside down?

Wouldn't that still apply the same logic per row, but in reverse?

I thought it would look something like:
(lastrow - xlrow) / ActiveSheet.Cells(1, 2).Value


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Bob Phillips" wrote in message
...
Mac,

Calculate the last row of data

Cells(Rows.Count,"A").End(xlUp).Row

and then run the lop backwards from that value to row 3

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ste mac" wrote in message
om...
Hi there, the code below works out the amount of rows on each sheet
and
divides it up percentage(wise) working from the top of the sheet,
starting
at 0% right down to the bottom of the used rows, ending at 100% on
each
range for each sheet...my question is:
Can this be turned upside down without using a 'sort' macro as it is
already sorted before the %ages are added..
So the top of the sheet/range is 100% and the bottom is 0%...

Thanks for any help anyone can give...cheers, ste

Sub getdepth()

Application.ScreenUpdating = False

For sheetNumber = 1 To 56

SheetName = "S" & Format(sheetNumber, "##0")
Sheets(SheetName).Select

xlrow = 3

Do While Not (ActiveSheet.Cells(xlrow, 1).Value = "")

ActiveSheet.Cells(xlrow, 10).Value = Format((xlrow /
ActiveSheet.Cells(1, 2).Value), "#0.0%")

xlrow = xlrow + 1

Application.StatusBar = "System Status: " & Format(xlrow
/ ActiveSheet.Cells(1, 2), "00%") & " of Depth %age for " & SheetName
& " have been built..."

Loop

Next

Application.StatusBar = False

Sheets("Selection").Select

checksystem_forblanks

End Sub





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Can this macro be made to work upside down?

Hi Bob!

And I would have bet my beer money that you'd say, "Send it to
Norman!"

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Can this macro be made to work upside down?

I'm not thinking that straight this late.

Bob

"Norman Harker" wrote in message
...
Hi Bob!

And I would have bet my beer money that you'd say, "Send it to
Norman!"

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Can this macro be made to work upside down?

Thanks Bob and Rob for your input, l didn't think this one would
be as easy as it sounds, thanks for your help anyway..

seeya ste


"Bob Phillips" wrote in message ...
I'm not thinking that straight this late.

Bob

"Norman Harker" wrote in message
...
Hi Bob!

And I would have bet my beer money that you'd say, "Send it to
Norman!"

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.


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
Writing Macro to Run after changes are made Dave Excel Discussion (Misc queries) 2 November 5th 09 03:00 AM
Can Excel 2007 title bar be made to work/look like earlier version Bill Excel Discussion (Misc queries) 1 September 9th 09 08:26 PM
Histogram made from multiple exel work books. frank Charts and Charting in Excel 1 June 16th 05 08:53 PM
Can a macro be made to work based on a formula? lonnied Excel Discussion (Misc queries) 2 January 26th 05 04:00 AM
Can a macro be made to work based on a formula? lonnied Excel Discussion (Misc queries) 0 January 26th 05 02:59 AM


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

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

About Us

"It's about Microsoft Excel"