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 Insert a ghost entry to a collection

Hi,

This code works great with one exception. Here is the code:

Sub hope_fully()

Dim days As New Collection
Dim data As New Collection
Dim collen As New Collection
Dim TR As Single
Dim SR As Single
Dim rnghold As Range
Dim rng As Range
Dim daysCNT As Single
Dim findme As Variant
Dim i As Single
Dim j As Single
Dim LN As Single
Dim found As Variant
Dim y As Single

Workbooks("Book2.xls").Activate

With Selection
daysCNT = Selection.Columns.Count
Set rnghold = Selection
For Each cell In rnghold
days.Add (cell)
Next
End With
MsgBox daysCNT

With days

For i = 1 To daysCNT Step 1
Workbooks("Book1.xls").Activate
Worksheets(days(i)).Select
TR = Cells(Rows.Count, 1).End(xlUp).Row
Set rng = Range("a1", Cells(TR / 2, 1))
With rng
findme = "7:30"
.Find(what:=findme, LookIn:=xlValues).Select
On Error Resume Next
findme = "7:00"
.Find(what:=findme, LookIn:=xlValues).Select
SR = Selection.Row
data.Add (Range(Cells(SR, 6), Cells(TR, 6)))
LN = TR - SR
collen.Add (LN)
End With

MsgBox SR
Next i

The problem relates to the find me section. first they're in tha
order cause All records contain a 7:30, but not all contain 7:00.
the way this sub inserts the data in book2 puts the starting point al
in the same row regardles of if the record started at 7:30 or 7:00.

my solution is to put a zero(0) in the beging of the data collectio
when the record starts and 7:30 (no 7:00 found). The problem is
don't know how.

any help or other ideas are appreciated

--
Message posted from http://www.ExcelForum.com

 
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
Automatically Insert Dates For Week Off One Day Entry CVinje Excel Discussion (Misc queries) 7 March 29th 09 07:37 AM
A way to auto insert at top of each column with each entry? Channing Excel Discussion (Misc queries) 4 September 9th 06 04:56 AM
Insert formula automatically with new entry Clare Excel Worksheet Functions 0 July 6th 06 11:47 AM
new row insert on data entry cjupiter Excel Discussion (Misc queries) 1 January 5th 06 02:58 PM
Automatically insert list entry oliverj Excel Discussion (Misc queries) 1 July 30th 05 12:29 AM


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