LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find & Format Data Using VBA


Every week I recieve a spreadsheet which I have to sort and analyse.

The code below is very basic and does what I want it to but I need it
to be more flexible.

In Column A there are personal ID Numbers. In the first part of code
below 201 refers to a person I have called Fred, in the second part 205
refers to a person I have called Bill.

I sort the worksheet by ID Number so all of the 201's are at the top
906 is at the bottom and loads of numbers are missing in bewteen.

Variables: There are varying numbers of entries for each code so there
could be 100 201's and 50 205's this week and 30 201's and 20 205's next
week.

Some weeks some ID Numbers may not appear at all i.e. this week 205 may
be in the worksheet next week it might not.

This is my problem the macro works fine until there is a week when an
ID Number doesn't appear then it falls over.

Can anyone suggest a way around please or some alternative code?



Code:
--------------------
Selection.Find(What:="201", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
ActiveCell.Offset(Row_No + 1, 0).Select
ActiveCell.Value = "FRED"
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.Font.Bold = True
Selection.Font.Underline = xlUnderlineStyleSingle
ActiveCell.Columns("A:A").EntireColumn.Select

Selection.Find(What:="205", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.Value = "BILL"
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.Font.Bold = True
Selection.Font.Underline = xlUnderlineStyleSingle
ActiveCell.Columns("A:A").EntireColumn.Select

--------------------


--
Timbo
------------------------------------------------------------------------
Timbo's Profile: http://www.thecodecage.com/forumz/member.php?userid=24
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=77492

 
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
Excel could not find the data ....check format Sarah H Pearson Excel Discussion (Misc queries) 0 October 27th 09 05:27 PM
Delete if find a data format Junior728 Excel Programming 2 May 11th 07 09:50 AM
Despite data existing in Excel 2002 spreadsheet Find doesn't find AnnieB Excel Discussion (Misc queries) 1 June 16th 06 02:15 AM
FIND DATA WITHIN DATA (V-OR-H LOOKUP/FIND/MATCH?) Jaladino Excel Worksheet Functions 0 February 22nd 05 11:22 PM
I need to find a macro to find data cut and paste to another colu. Rex Excel Programming 6 December 7th 04 09:22 AM


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