PC Review


Reply
Thread Tools Rate Thread

How to accomplish?

 
 
steve grosz
Guest
Posts: n/a
 
      6th Oct 2008
Ok here's my situation. I'm not much of a VB programmer, but wanted to try
something.

We generate a worksheet once a week that has 4 columns.

Col1 - name
Col2 - last weeks position (a number value)
Col3 - this weeks position (a number value)
Col4 - size

I would like to compare col 2 & 3, and if col1 is larger, display a image,
if col2 is large, display a different image in a cell on the same sheet.

How can I accomplish this? Loop through all the users, compare the values
of col2 & 3 for each of them and display a image in a seperate cell, say
col 5??

Any help on this would be greatly appreciated!!!!

Thanks!
Stev


 
Reply With Quote
 
 
 
 
Thomas [PBD]
Guest
Posts: n/a
 
      6th Oct 2008
Steve Grosz,

You could use the following VBA, I was considering a couple of things.
First of all, there are no blanks in Column A, which the the NAME column.
Second, that Columns 1 - 4 are A,B,C,D. Please amend the code as necessary
for your needs, or repost for more help.

Public Sub Sub_1()
Dim x As Long
x = Excel.WorksheetFunction.CountA(Columns("A:A"))
For y = 2 To x
Range("A1").Cells(y, 5).Formula = "=IF(C" & y & ">B" & y & ",TRUE,FALSE)"
Next
End Sub

You can filter on Column 5 for TRUE to see the Last Week to This Week Changes.

--
--Thomas [PBD]
Working hard to make working easy.
Answered your question? Click ''''Yes'''' below.


"steve grosz" wrote:

> Ok here's my situation. I'm not much of a VB programmer, but wanted to try
> something.
>
> We generate a worksheet once a week that has 4 columns.
>
> Col1 - name
> Col2 - last weeks position (a number value)
> Col3 - this weeks position (a number value)
> Col4 - size
>
> I would like to compare col 2 & 3, and if col1 is larger, display a image,
> if col2 is large, display a different image in a cell on the same sheet.
>
> How can I accomplish this? Loop through all the users, compare the values
> of col2 & 3 for each of them and display a image in a seperate cell, say
> col 5??
>
> Any help on this would be greatly appreciated!!!!
>
> Thanks!
> Steve
>
>
>

 
Reply With Quote
 
steve grosz
Guest
Posts: n/a
 
      6th Oct 2008
Hello Thomas [PBD],

Ok, that sort of does what I would like. I would like to check to see if
b & c are the same, b is higher than c, or c higher than b, and display an
image indicating if there has been a increase (b higher than c) decrease
(c higher than b) or no change.....

Thanks!

> Public Sub Sub_1()
> Dim x As Long
> x = Excel.WorksheetFunction.CountA(Columns("A:A"))
> For y = 2 To x
> Range("A1").Cells(y, 5).Formula = "=IF(C" & y & ">B" & y &
> ",TRUE,FALSE)"
> Next
> End Su



 
Reply With Quote
 
Thomas [PBD]
Guest
Posts: n/a
 
      6th Oct 2008
Steve Grosz,

You would like it to create an "image", by image you mean a picture? That
would be much harder to do as you would have to define an Image Object and
have it relate to the reference point in the book. You could always change
the IF statement that I used to have it say "B > C" or "B < C" or "No
Change". Creating a picture wouldn't make the information usable, unless you
are using it just to look at.

Here is another look at it, this will place B>C, B<C, No Change in the cells:

Public Sub Sub_1()

Dim x As Long
x = Excel.WorksheetFunction.CountA(Columns("A:A"))

For y = 2 To x
If Cells(y, 2).Value > Cells(y, 3).Value Then
Cells(y, 5).Value = "B>C"
Else
If Cells(y, 2).Value < Cells(y, 3).Value Then
Cells(y, 5).Value = "B<C"
Else
If Cells(y, 2).Value = Cells(y, 3).Value Then
Cells(y, 5).Value = "No Change"
End If
End If
End If
Next

End Sub

--
--Thomas [PBD]
Working hard to make working easy.
Answered your question? Click ''''Yes'''' below.


"steve grosz" wrote:

> Hello Thomas [PBD],
>
> Ok, that sort of does what I would like. I would like to check to see if
> b & c are the same, b is higher than c, or c higher than b, and display an
> image indicating if there has been a increase (b higher than c) decrease
> (c higher than b) or no change.....
>
> Thanks!
>
> > Public Sub Sub_1()
> > Dim x As Long
> > x = Excel.WorksheetFunction.CountA(Columns("A:A"))
> > For y = 2 To x
> > Range("A1").Cells(y, 5).Formula = "=IF(C" & y & ">B" & y &
> > ",TRUE,FALSE)"
> > Next
> > End Sub

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How to accomplish this Pete_UK Microsoft Excel Misc 0 12th Mar 2010 06:54 PM
How should I accomplish this? _Bigred Microsoft Access Database Table Design 1 13th Jun 2006 02:20 PM
How can I accomplish this? =?Utf-8?B?SmVzcw==?= Microsoft Outlook VBA Programming 1 14th Jan 2005 08:04 PM
How to accomplish this ? Jill Graham Microsoft Dot NET 0 7th May 2004 11:02 PM
Best way to accomplish this? Massimo Microsoft ADO .NET 1 8th Apr 2004 11:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:57 PM.