Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Macro programming.

Thread Tools
 
Search this Thread
 
Old 30 August 2006, 03:15 PM
  #1  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Default Macro programming.

i want a specific macro programming that i cant get my head around doing.(Not used macro in a long time)

just wonder if anyone out there is any good at programmnig these for Excel?

Cheers

S
Old 30 August 2006, 03:20 PM
  #2  
ChefDude
Scooby Regular
 
ChefDude's Avatar
 
Join Date: Aug 2005
Posts: 4,290
Likes: 0
Received 0 Likes on 0 Posts
Default

what do you want to do?
Old 30 August 2006, 03:26 PM
  #3  
bob269
Scooby Regular
 
bob269's Avatar
 
Join Date: Mar 2003
Posts: 2,654
Likes: 0
Received 1 Like on 1 Post
Default

Originally Posted by ChefDude
what do you want to do?
A Crystal Ball macro?
Old 30 August 2006, 03:39 PM
  #4  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Default

Right,

Got ports 1-24. If the cell is yellow ignore it, it's a trunk port.

If the number is highlighted blue, i want a total at the end of the row to indicate that there is x amount of free ports on this switch.

Does that help ? not sure if i need a marco. Is that i know some how the cell properties will come into play.

Si
Old 30 August 2006, 04:21 PM
  #5  
GaryK
Scooby Regular
 
GaryK's Avatar
 
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes on 0 Posts
Default

Si,

Wouldnt it just be easier to have no number in a cell for a trunk port and a number in one that isnt and just total em up?

Or your penchant for pretty colours like yellow and pink getting the better of you? (LMAO)

Gary
Old 30 August 2006, 04:38 PM
  #6  
bob269
Scooby Regular
 
bob269's Avatar
 
Join Date: Mar 2003
Posts: 2,654
Likes: 0
Received 1 Like on 1 Post
Default

Paste this in to a VBA module

Code:
Public Function CountIfColor(rng As Range, clrindx As Integer)
Dim Cell
CountIfColor = 0
For Each Cell In rng.Cells
If Cell.Interior.ColorIndex = clrindx Then
CountIfColor = CountIfColor + 1
End If
Next Cell
End Function
Then your formula for your spreadsheet would be :-

Code:
=CountIfColor(A1:A100,3)
This checks range a1:a100 for cells with the BACKGROUND colour of Red (Index 3)

This can be modified to suit your needs
Old 30 August 2006, 04:44 PM
  #7  
ChefDude
Scooby Regular
 
ChefDude's Avatar
 
Join Date: Aug 2005
Posts: 4,290
Likes: 0
Received 0 Likes on 0 Posts
Default

the easiest way to get to the right object code is to record a macro doing a similar thing and then go crib the code from the macro.

eg;

Dim r&, c&

c = 2

For r = 1 To 60
ActiveSheet.Cells(r, c).Select
If Selection.Interior.ColorIndex = 6 Then
ActiveSheet.Cells(r, c + 1) = "it was yellow"
End If
Next


does the job
Old 30 August 2006, 04:44 PM
  #8  
ChefDude
Scooby Regular
 
ChefDude's Avatar
 
Join Date: Aug 2005
Posts: 4,290
Likes: 0
Received 0 Likes on 0 Posts
Default

i see everyone else is bored trying to work out errors with cross rates then lol
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Littleted
Computer & Technology Related
2
14 September 2015 08:20 PM
Stueyb
Computer & Technology Related
3
27 August 2004 09:09 AM
velohead66
Computer & Technology Related
7
14 May 2003 09:31 AM
airhead
Non Scooby Related
3
08 October 2001 08:02 AM



Quick Reply: Macro programming.



All times are GMT +1. The time now is 12:55 PM.