LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default New to VBA

Sorry Bob it wasjust my lack of experience with VBA it works perfectly
thanks just need to make a few adjustments to make it fit my
spreadsheet.

However I have now decided to add something else in to the code you
gave me.

Basically as I have so much data when I run the Macro the screen looks
like it freezes up and I know for the people that will be using it they
will think that it has crashed and will try to shut it down. So I went
searching for a way to add in a progress bar so as the Macro is running
it will show a percentage complete which will show that the spreadsheet
as not crashed but is still calculating.

I wnt onto the groups and found a macro for a progress bar using a
userform, however I'm struggling to wrap that piece of code around my
original piece of code.

If anyone could help out that would be great as I could really do with
it. Hopefully its just a case of jumbling it around to make it work.

Here it is....

Sub Form()
' The UserForm1_Activate sub calls Main
UserForm1.LabelProgress.Width = 0
UserForm1.Show
End Sub

Sub Test ()

Dim iLastRow As Long
Dim i As Long
Dim ipos As Long
Dim PctDone As Single
Dim r As Integer
Dim Cell As Object
Dim Count As Integer


Count = 0
For Each Cell In Selection
Count = Count + 1
For i = iLastRow To 2 Step -1
If Cells(i, "C").Value = Cells(i - 1, "C").Value Then
Cells(i, "S").Resize(1, 100).Copy Cells(i - 1, "T")
Rows(i).Delete
End If
Next i
Next Cell
For r = 1 To Cell
Count = Count + 1
PctDone = Count / Cell
With UserForm1
.FrameProgress.Caption = Format(PctDone, "0%")
.LabelProgress.Width = PctDone * (.FrameProgress.Width -
10)
End With
' The DoEvents statement is responsible for the form updating
DoEvents
Next r
Unload UserForm1

End Sub

 
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



All times are GMT +1. The time now is 04:54 AM.

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"