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 Aug 30, 2006 | 03:15 PM
  #1  
super_si's Avatar
super_si
Thread Starter
Scooby Regular
 
Joined: Feb 2002
Posts: 7,951
Likes: 0
From: Lurkin Somewhere
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
Reply
Old Aug 30, 2006 | 03:20 PM
  #2  
ChefDude's Avatar
ChefDude
Scooby Regular
 
Joined: Aug 2005
Posts: 4,291
Likes: 0
Default

what do you want to do?
Reply
Old Aug 30, 2006 | 03:26 PM
  #3  
bob269's Avatar
bob269
Scooby Regular
 
Joined: Mar 2003
Posts: 2,654
Likes: 1
Default

Originally Posted by ChefDude
what do you want to do?
A Crystal Ball macro?
Reply
Old Aug 30, 2006 | 03:39 PM
  #4  
super_si's Avatar
super_si
Thread Starter
Scooby Regular
 
Joined: Feb 2002
Posts: 7,951
Likes: 0
From: Lurkin Somewhere
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
Reply
Old Aug 30, 2006 | 04:21 PM
  #5  
GaryK's Avatar
GaryK
Scooby Regular
 
Joined: Sep 1999
Posts: 4,037
Likes: 0
From: Bedfordshire
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
Reply
Old Aug 30, 2006 | 04:38 PM
  #6  
bob269's Avatar
bob269
Scooby Regular
 
Joined: Mar 2003
Posts: 2,654
Likes: 1
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
Reply
Old Aug 30, 2006 | 04:44 PM
  #7  
ChefDude's Avatar
ChefDude
Scooby Regular
 
Joined: Aug 2005
Posts: 4,291
Likes: 0
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
Reply
Old Aug 30, 2006 | 04:44 PM
  #8  
ChefDude's Avatar
ChefDude
Scooby Regular
 
Joined: Aug 2005
Posts: 4,291
Likes: 0
Default

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




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