Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Simple Macro - I Think?


Ron,

I truly appreciate your reply. However, your formula is way above my
level of understanding.

I would not know where to put the formula and how to execute it.

Is there a bit more information that would be understandable by a
novice? If not, thanks again for your interest.

Vince


--
vinclanz
------------------------------------------------------------------------
vinclanz's Profile: http://www.excelforum.com/member.php...o&userid=14595
View this thread: http://www.excelforum.com/showthread...hreadid=262215

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Simple Macro - I Think?

On Sun, 26 Sep 2004 16:47:29 -0500, vinclanz
wrote:


Ron,

I truly appreciate your reply. However, your formula is way above my
level of understanding.

I would not know where to put the formula and how to execute it.

Is there a bit more information that would be understandable by a
novice? If not, thanks again for your interest.

Vince


Sorry, Vince. The Programming NG is usually used for VBA solutions. And your
problem lends itself to a VB solution as you cannot have a formula and a value
in Column A at the same time.

To use the macro that I posted:

<alt<F11 (That means hold down the Alt key and the F11 keys at the same time)
opens the Visual Basic Editor.

Ensure your project is highlighted in the Project Explorer Window.

Then (on the top menu) Insert/Module and paste the code into the window that
opens. I changed the code a bit to put in a test for valid information in the
range to be tested. Note that you should change the range in the Set statement
to reflect the range upon which this macro should operate.

=================
Sub BgtA()
Dim rg As Range
Dim c As Range

Set rg = [B1:B100] 'set this to the appropriate range of B

For Each c In rg
If IsNumeric(c.Value) And IsNumeric(c.Offset(0, -1)) Then
If c.Value c.Offset(0, -1).Value Then
c.Offset(0, -1).Value = c.Value
End If
End If
Next c

End Sub
=====================

Then return to your worksheet window. <alt<F8 opens the Macro dialog box.
You will see BgtA in that box. Select that macro and then select RUN.

Below is a somewhat annotated version of the macro to help you understand what
it is doing.

=========================
Sub BgtA()
Dim rg As Range
Dim c As Range

Set rg = [B1:B100] 'set this to the appropriate range of B

'check every cell in the range "rg"
For Each c In rg

'first see if the value in the cell can be interpreted as a number
If IsNumeric(c.Value) And IsNumeric(c.Offset(0, -1)) Then

'if it is a number, then compare it's value with _
the cell in the same row, one column to the left (Column A)
If c.Value c.Offset(0, -1).Value Then

'if that value is greater, then replace it _
otherwise, do nothing
c.Offset(0, -1).Value = c.Value
End If
End If
Next c

End Sub
===========================

Let me know how it works out.




--ron
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
Simple macro MikeD1224 Excel Discussion (Misc queries) 1 June 9th 07 12:06 AM
a simple macro? asalerno Excel Discussion (Misc queries) 2 April 28th 06 12:45 AM
Simple macro please sasha New Users to Excel 1 July 19th 05 12:51 PM
Simple Macro (I think) Jason Excel Programming 4 September 9th 04 02:54 AM
Help with simple(?) macro Cutter[_2_] Excel Programming 7 July 2nd 04 01:30 AM


All times are GMT +1. The time now is 01:20 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"