Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Convert to Excel Macro

Hi all, I need some help here.

I need this logic converted to an excel 2003 macro:

Current.worksheet
Do x = 6 by 1 (until there is no more data in column A)
If the cell value Ax cell value Bx then cell value Bx = cell value Ax
If the cell value Ax < cell value Cx then cell value Cx = cell value Ax
End Do

All my feeble attempts fail.
Thanks,
Wes
  #2   Report Post  
Junior Member
 
Location: Lakehurst, NJ, USA
Posts: 19
Default

Quote:
Originally Posted by Wes Finch View Post
Hi all, I need some help here.

I need this logic converted to an excel 2003 macro:

Current.worksheet
Do x = 6 by 1 (until there is no more data in column A)
If the cell value Ax cell value Bx then cell value Bx = cell value Ax
If the cell value Ax < cell value Cx then cell value Cx = cell value Ax
End Do

All my feeble attempts fail.
Thanks,
Wes
Give this a try:

Sub marine()
Dim N As Long, x As Long
N = Cells(Rows.Count, "A").End(xlUp).Row
For x = 6 To N
If Cells(x, 1) Cells(x, 2) Then
Cells(x, 2) = Cells(x, 1)
End If
If Cells(x, 1) < Cells(x, 3) Then
Cells(x, 3) = Cells(x, 1)
End If
Next x
End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Convert to Excel Macro

Thanks Mike,
It works great with just one minor modification as the cells would be empty on the first run:

If Cells(x, 1) < Cells(x, 3) Or IsEmpty(Cells(x, 2)) Then

I appreciate your help.
Wes
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Convert to Excel Macro

On Thursday, March 7, 2013 8:45:01 AM UTC-5, Paga Mike wrote:
Wes Finch;1609999 Wrote:

Hi all, I need some help here.




I need this logic converted to an excel 2003 macro:




Current.worksheet


Do x = 6 by 1 (until there is no more data in column A)


If the cell value Ax cell value Bx then cell value Bx = cell value


Ax


If the cell value Ax < cell value Cx then cell value Cx = cell value


Ax


End Do




All my feeble attempts fail.


Thanks,


Wes




Give this a try:



Sub marine()

Dim N As Long, x As Long

N = Cells(Rows.Count, "A").End(xlUp).Row

For x = 6 To N

If Cells(x, 1) Cells(x, 2) Then

Cells(x, 2) = Cells(x, 1)

End If

If Cells(x, 1) < Cells(x, 3) Then

Cells(x, 3) = Cells(x, 1)

End If

Next x

End Sub









--

Paga Mike


Thanks MIke!
I got it working!

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
Convert to Excel Macro Wes Finch Excel Programming 3 March 5th 13 04:49 AM
Lotus macro i need to convert to Excel Sammy Excel Discussion (Misc queries) 4 April 28th 10 09:31 PM
macro to convert excel to PDF EricBB Excel Discussion (Misc queries) 2 March 18th 09 04:03 PM
convert a Word macro to an Excel macro jsd219 Excel Programming 32 October 27th 06 03:58 PM
Convert excel 5.0 macro Staes Jan Excel Programming 1 October 20th 04 01:00 PM


All times are GMT +1. The time now is 09:28 PM.

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"