Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Backwards compatibile macro

Hi,
I'm using Excel 2010. I have a macro saved in the personal workbook but it doesn't work on workbooks in compatibility mode. If I save the macro directly into the older version workbook, the macro works fine. Would anybody know how to make my code work regardless of which version the workbook is? Here is the code I have:



Sub ForEachCellInRange()
Dim iCell As Range
Dim rowNo As Integer
For Each iCell In Sheet1.Range("A1:A20")
rowNo = iCell.Row
If Sheet1.Cells(rowNo, 1) Like "ABC123" And Sheet1.Cells(rowNo, 2) Like "5 gal bucket" And Sheet1.Cells(rowNo, 3) Like "Car" Then
Sheet1.Cells(rowNo, 4).Value = "1F"
ElseIf Sheet1.Cells(rowNo, 1) Like "ADC321" And Sheet1.Cells(rowNo, 2) Like "25 gal bucket" And Sheet1.Cells(rowNo, 3) Like "Tractor" Then
Sheet1.Cells(rowNo, 4).Value = "2F"
ElseIf Sheet1.Cells(rowNo, 1) Like "EDK293" And Sheet1.Cells(rowNo, 2) Like "10 gal bucket" And Sheet1.Cells(rowNo, 3) Like "Truck" Then
Sheet1.Cells(rowNo, 4).Value = "3F"
ElseIf Sheet1.Cells(rowNo, 1) Like "REA322" And Sheet1.Cells(rowNo, 2) Like "15 gal bucket" And Sheet1.Cells(rowNo, 3) Like "Scooter" Then
Sheet1.Cells(rowNo, 4).Value = "4F"
End If
Next iCell
End Sub
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
The A,B,C,D at the top of my page are backwards ambers-life Excel Discussion (Misc queries) 2 February 28th 08 04:13 PM
Backwards lookup Derek Excel Worksheet Functions 3 April 1st 05 05:53 PM
backwards sum choice[_2_] Excel Programming 0 February 28th 05 07:23 AM
Stepping through For Each...Next backwards? Mike Lee[_2_] Excel Programming 5 June 6th 04 07:42 PM
Tab backwards Garry Jones Excel Programming 3 November 5th 03 11:41 AM


All times are GMT +1. The time now is 10:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"