Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35
Default Create a procedure or function

Hello everyone!

I'm now using Excel 2007.

I have a file with some sheets. In one of the sheets I have the
following code:

Sub CSO()
' CSO Macro
' ordenar colaboradores por ranking
'
' Keyboard Shortcut: Ctrl+o
'

ActiveWorkbook.ActiveSheet.Sort.SortFields.Clear
ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key:=Range("R9:R40"), _
SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:=xlSortNormal
With ActiveWorkbook.ActiveSheet.Sort
.SetRange Range("B9:AA40")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

bons = ActiveWorkbook.ActiveSheet.Range("AL12")
medios = ActiveWorkbook.ActiveSheet.Range("AL10")
maus = ActiveWorkbook.ActiveSheet.Range("AL9")

celinicio = 9
celula = "AG" + CStr(celinicio)
celulanome = "B" + CStr(celinicio)
'contador = bons
Total = bons + medios + maus

For i = 1 To Total
If bons 0 Then
celula = "AE" + CStr(celinicio)
ActiveWorkbook.ActiveSheet.Range(celula) =
ActiveWorkbook.ActiveSheet.Range(celulanome)
bons = bons - 1
ElseIf medios 0 Then
celula = "AD" + CStr(celinicio)
ActiveWorkbook.ActiveSheet.Range(celula) =
ActiveWorkbook.ActiveSheet.Range(celulanome)
medios = medios - 1
ElseIf maus 0 Then
celula = "AC" + CStr(celinicio)
ActiveWorkbook.ActiveSheet.Range(celula) =
ActiveWorkbook.ActiveSheet.Range(celulanome)
maus = maus - 1
End If
celinicio = celinicio + 1
celulanome = "B" + CStr(celinicio)

Next i
End Sub



I intend to create a procedure or function (to go to search to help) and
later invoking in each one of sheets this procedure, of form to apply
this code in some sheets.

Please help and thanks in advance!
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
Stop a Procedure from another procedure Ayo Excel Discussion (Misc queries) 1 October 30th 08 01:42 AM
Procedure is too big Frank Situmorang Excel Worksheet Functions 2 May 2nd 07 05:06 AM
VBA Procedure Jeff Excel Discussion (Misc queries) 0 January 20th 06 04:22 PM
Defined Named cells lined to a Function Procedure swiftcode Excel Worksheet Functions 4 October 11th 05 08:30 AM


All times are GMT +1. The time now is 02:06 AM.

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"