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: 6
Default Run-Time error 1004

Frustration is setting in....

I am writing a macro to parse through a bunch of data, find a range of
consecutive cells that match a date, and eventually create a chart based on
that range. For now, however, I just want to highlight the range or change
it's color or something to make sure I am grabbing the correct info.

Here is what I have:

FoundFirstDate = False
FoundLastDate = False
Prompt1 = "Please enter the date for which to create charts"
Title1 = "Daily Chart Creation"
Default1 = Date

DateToChart = InputBox(Prompt1, Title1, Default1)
Worksheets("Chart Data").Activate
RowNum = 2
ColNum = 4
Cells(RowNum, ColNum).Select
'find first date
Do While Not FoundFirstDate And ActiveCell.Value < ""
If ActiveCell.Value = DateToChart Then
FoundFirstDate = True
DateStart = RowNum
End If
RowNum = RowNum + 1
Cells(RowNum, ColNum).Select
Loop
'find last date
Do While Not FoundLastDate And ActiveCell.Value < ""
If ActiveCell.Value < DateToChart Then
FoundLastDate = True
DateFinish = RowNum - 1
End If
RowNum = RowNum + 1
Cells(RowNum, ColNum).Select
Loop
If Not FoundFirstDate Or Not FoundLastDate Then Exit Sub

'set the range
RangeName = "D" & DateStart & ":D" & DateFinish

Set DailyChartRange = ActiveSheet.Range(RangeName)
Worksheets("Chart Data").Range(DailyChartRange).Select
Selection.Font.ColorIndex = 3

I realize that I am probably doing this the hard way; however, I am not sure
of a better way to do this. Anyway, when the code executes, I receive a
run-time error 1004 and the code stops at the range selection line.

Any ideas?????????

Thanks in advance


 
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
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Run time error '1004': Generaol ODBC error Dwaine Horton[_3_] Excel Programming 2 April 26th 05 02:52 PM
Run time error 1004 General ODCB Error Kevin Excel Programming 3 February 26th 05 12:51 PM
Application Run Time Error 1004 and Stack Error ExcelMonkey[_190_] Excel Programming 9 February 11th 05 04:48 PM


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