Re: Enlighten me - Mac vs. PC processing speeds



On 2/26/08 9:37 PM, in article
f4369011-eb5a-4c81-9478-fae6667433fb@xxxxxxxxxxxxxxxxxxxxxxxxxxxx,
"c1802362@xxxxxxx" <c1802362@xxxxxxx> wrote:

On Feb 26, 8:00 am, Bob Greenblatt <b...@xxxxxxxxxx> wrote:
Without looking at your code, it's pretty hard to tell, but here are a few
things:
- 1. it's just slower on a Mac. (how much slower, depends on what you are
doing.)
- 2. displayupdating=false isn't quite the same thing on the Mac as windows,
the Mac display is still repainted under certain conditions.
- 3. on either platform, NEVER activate, and/or select items, ranges, etc.
It REALLY REALLY slows things down.

--
Bob Greenblatt [MVP], Macintosh
bobgreenblattATmsnDOTcom

I probably broke the do not select rule, but if you can give me any
guidance it would be greatly appreciated:
I have modified your code, and interspersed a few comments and better (in my
opinion) code below yours. I did not go through the whole sub, but you
should get the idea. If not, post again. (I did not specifically test code
below.)

first the code
**************************

Sub SelectDown()
Dim count As Integer, pointer As Integer, num As Integer
Dim lastrow As Long
Dim rR as Range
count = 1 'sets the destination row location
pointer = 3 'locates the source data location's start

' find the last row in the file
lastrow = Range("b65536").End(xlUp).Row
lastrow=cells.specialcells(xlceltypelastcell).row
Range("A1").Select
Don't do this
Application.ScreenUpdating = False

Do Until pointer > lastrow

' find the start of the next data record
Cells.Find(What:="STCNumber", After:=ActiveCell, _
SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Set rr= cells.Find(What:="STCNumber", After:=ActiveCell, _
SearchOrder:=xlByRows, SearchDirection:=xlNext)

' move over one column to data
ActiveCell.Offset(0, 1).Range("a1").Select
No need for this
' select this data to the end of the record
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Selection.Copy
'don't select it, do this instead:
Rr.resize(rr.end(xldown))

' count the number of cells in this record
selRange = Range(ActiveCell,
ActiveCell.End(xlDown)).Address(rowabsolute:=True,
columnabsolute:=True)
num = Range(selRange).count
'Instead,
Num=rr.cells.count
Rr.copy

'transpose and paste the selected record a few columns over
Cells(count, 3).PasteSpecial Transpose:=True
'advance the row pointer
count = count + 1

' advance the source data cell pointer
pointer = pointer + num

' go to the next data record
Cells(pointer, 1).Select
pointer = pointer + 1

Loop

Application.ScreenUpdating = True

'add a new *** and place the data from the source *** on it

ActiveCell.Cells.Select
Cells.Select
I don't think you need these 2 lines
Selection.Copy
Sheets.Add
Range("A1").Select 'It's not necessary as it already is selected
Active***.Paste

'delete the first two columns (original data)
I'm confused now, you still on the new work***
ActiveCell.Columns("A:B").EntireColumn.Select
ActiveCell.Offset(0, 1).Range("A1").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Columns("a:b").delete shift xltoleft

ActiveCell.Offset(0, -1).Columns("A:H").EntireColumn.Select
Selection.ColumnWidth = 27.71
Columns("a:h").columnwidth=27.71
Range("A1").Select
I admit, I might have missed something. You have confused me by referencing
A1 after doing an offset of a range. If this does not work, or not work
faster, email me a sample with some actual data and an example of how you
want the data to end up, and I'll try again.

--
Bob Greenblatt [MVP], Macintosh
bobgreenblattATmsnDOTcom

.