Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default find location

Drives me nuts! It seems that when I open a new workbook the default format
for dates (entered as 31/12/2007 for example) will be "General" on sheet1 and
"dd/mm/yyyy" on sheet2. Hence my testing only worked if I started on the
correctly formated sheet!!!! Aaaggh!

I found a work around by linking the data report date to a cell in the
control sheet formatted as "General" to get the serial number. The following
code then converted the search area to serial and back again after the
location was found. I'm greatful for your help in pointing me in the right
direction.

Here it is if anyone is interested.

======================================
Sub FindCurMonth()

Dim CurLocation As Range
Dim addr As String
Dim curDate As String
Dim rng As Range

Application.ScreenUpdating = False

curDate = Sheets("Control").Range("B1").Value
Sheets("Cheops").Rows(13).NumberFormat = "general"

On Error Resume Next
Set CurLocation = Rows(13).Find(What:=curDate, LookIn:=xlValues)
Set rng = Range(CurLocation.Address)
Debug.Print (rng.Address)

Application.ScreenUpdating = True

If Not CurLocation Is Nothing Then
addr = CurLocation.Address
Application.Goto CurLocation.Offset(3, 0).Select
Else
MsgBox "Period Date Not Found"
End If

Sheets("Cheops").Rows(13).NumberFormat = "mmm-yy"

End Sub


--
Jim


" wrote:

Funny - didn't work for me as a string but did as a Variant. Dates are
a pain, especially with Find and Filtering..
Paul

On Feb 5, 12:30 am, Jim G wrote:
I'd tried that previously and it only works if it's a string.

However, I tried the code on a new workbook and it works it it's a string,
formula or date. So, would this indicate there is something in the workbook
that is causing the error.



--
Jim- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



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
How to find out the cell location Lamb Chop Excel Discussion (Misc queries) 3 September 7th 06 12:22 PM
Is it Possible to Find Shape at a Location (#find) for XL97? JK Excel Programming 4 March 16th 06 06:15 PM
find location max value in column rroach Excel Discussion (Misc queries) 3 July 13th 05 10:27 PM
find cell location of max value in column rroach Excel Programming 6 June 6th 05 04:59 PM
find location Ed Excel Programming 2 August 17th 04 09:20 PM


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