LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Find specific cells

I think I'd just start at the bottom and work my way up looking for numbers:

Option Explicit
Option Base 0
Sub testme()

Dim fCtr As Long
Dim myAddresses As Variant
Dim otherWks As Worksheet
Dim wks As Worksheet
Dim cCtr As Long
Dim myRng As Range
Dim NumberOfAddresses As Long


myAddresses = Array("AT3", "AU3", "AV3")
NumberOfAddresses = UBound(myAddresses) - LBound(myAddresses) + 1

Set wks = ActiveSheet

Set otherWks = Workbooks("book2.xls").Worksheets("sheet1")

With wks
Set myRng = .Range("J100:J1000")
fCtr = 0
For cCtr = myRng.Cells.Count To 1 Step -1
If Application.IsNumber(myRng.Cells(cCtr).Value) Then
fCtr = fCtr + 1
otherWks.Range(myAddresses(fCtr - 1)).Value _
= myRng.Cells(cCtr).Value
If fCtr = NumberOfAddresses Then
Exit For
End If
End If
Next cCtr

If fCtr < NumberOfAddresses Then
MsgBox "Only " & fCtr & " numbers found instead of " _
& NumberOfAddresses & "."
End If
End With

End Sub

The bottom most on the list goes to AT3, then AU3, then AV3?

If not just change the order in this line:

myAddresses = Array("AT3", "AU3", "AV3")

sirjadin26 wrote:

I'm sort of new to VBA programming with Excel and am trying to write a
code that will do the following:

1) search a range covering J100:J1000 looking for the last 3 cells
which have numbers in them, skipping over those cells with text.

2) I want to copy those three numbers to a worksheet in a different
excel book
to range AT3, AU3 and AV3

It sounds simple in my mind but I can't see to do it. and I would
appreciate any help in this.

Sirjadin26

--
sirjadin26
------------------------------------------------------------------------
sirjadin26's Profile: http://www.excelforum.com/member.php...o&userid=24427
View this thread: http://www.excelforum.com/showthread...hreadid=380307


--

Dave Peterson
 
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
Find Cells that add up to Specific Sum BeachLover Excel Worksheet Functions 5 January 2nd 09 03:23 PM
how can I find which cells in a dataset equal a specific value chrisk Excel Worksheet Functions 1 August 23rd 07 02:42 PM
find cells that contain specific characters mshornet Excel Worksheet Functions 8 November 23rd 05 02:02 PM
How can I find and format specific cells automatically in Excel? Amy Excel Worksheet Functions 1 August 6th 05 03:00 PM
How to find a specific inform with some cells and return total sean Excel Programming 0 January 16th 04 04:44 PM


All times are GMT +1. The time now is 09:42 AM.

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"