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


Its very simple but i keep getting runtime errors!!!
Here is my code:

sub test()
Dim i, x, y, z As Variant
Dim w As String
Dim chr(100) As String
Dim num1(100) As Integer
Dim num2(100) As Integer
Dim num3(100) As Integer
Sheets("TEST TSC").Select
-Range("A1").Select *<---------------- Run-time error '1004'*-
w = ActiveCell.Value
Sheets("Jan FTR").Select
Range("A1").Select
Range("E:E").Find(What:=w, Lookat:=xlWhole, LookIn:=xlValues).Select
ActiveCell.Offset(0, 2).Select
Do
chr(i) = ActiveCell.Value
num1(i) = ActiveCell.Offset(0, 1).Value
num2(i) = ActiveCell.Offset(0, 2).Value
num3(i) = ActiveCell.Offset(0, 3).Value
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop While ActiveCell.Offset(0, -2).Value = ""

Sheets("TEST TSC").Select
Range("A6").Select
i = 0
Do While ActiveCell.Value < ""
If chr(i) = ActiveCell.Value Then
ActiveCell.Offset(0, 3).Value = num1(i)
ActiveCell.Offset(0, 4).Value = num2(i)
ActiveCell.Offset(0, 6).Value = num3(i)
ActiveCell.Offset(1, 0).Select
i = i + 1
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
end sub

What can i do to fix this?????
If i comment it out, the error occurs on all the "Range" commands!!!

--
hemant
-----------------------------------------------------------------------
hemants's Profile: http://www.excelforum.com/member.php...fo&userid=1503
View this thread: http://www.excelforum.com/showthread.php?threadid=26667

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Run Time Errors

Hermants,

I haven't run this but

replace

Sheets("TEST TSC").Select
-Range("A1").Select

With

Worksheets"(TEST TSC").range("A1").Select





Sheets("TEST TSC").Select
-Range("A1").Select *<---------------- Run-time error '1004'*-
hemants
------------------------------------------------------------------------
hemants's Profile:
http://www.excelforum.com/member.php...o&userid=15031
View this thread: http://www.excelforum.com/showthread...hreadid=266679



  #3   Report Post  
Posted to microsoft.public.excel.programming
N10 N10 is offline
external usenet poster
 
Posts: 141
Default Run Time Errors

Hi

Try

Range("A1").Select

instead of
-Range("A1").Select

You have a symbol before the range instruction.

Hope this helps :)


Best N10

"hemants" wrote in message
...

Its very simple but i keep getting runtime errors!!!
Here is my code:

sub test()
Dim i, x, y, z As Variant
Dim w As String
Dim chr(100) As String
Dim num1(100) As Integer
Dim num2(100) As Integer
Dim num3(100) As Integer
Sheets("TEST TSC").Select
-Range("A1").Select *<---------------- Run-time error '1004'*-
w = ActiveCell.Value
Sheets("Jan FTR").Select
Range("A1").Select
Range("E:E").Find(What:=w, Lookat:=xlWhole, LookIn:=xlValues).Select
ActiveCell.Offset(0, 2).Select
Do
chr(i) = ActiveCell.Value
num1(i) = ActiveCell.Offset(0, 1).Value
num2(i) = ActiveCell.Offset(0, 2).Value
num3(i) = ActiveCell.Offset(0, 3).Value
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop While ActiveCell.Offset(0, -2).Value = ""

Sheets("TEST TSC").Select
Range("A6").Select
i = 0
Do While ActiveCell.Value < ""
If chr(i) = ActiveCell.Value Then
ActiveCell.Offset(0, 3).Value = num1(i)
ActiveCell.Offset(0, 4).Value = num2(i)
ActiveCell.Offset(0, 6).Value = num3(i)
ActiveCell.Offset(1, 0).Select
i = i + 1
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
end sub

What can i do to fix this?????
If i comment it out, the error occurs on all the "Range" commands!!!!


--
hemants
------------------------------------------------------------------------
hemants's Profile:
http://www.excelforum.com/member.php...o&userid=15031
View this thread: http://www.excelforum.com/showthread...hreadid=266679



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.772 / Virus Database: 519 - Release Date: 01/10/2004


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Run Time Errors

If the code is in a sheet module, move it to a general module. (the result
of Insert=Module in the VBE)

--
Regards,
Tom Ogilvy


"hemants" wrote in message
...

Its very simple but i keep getting runtime errors!!!
Here is my code:

sub test()
Dim i, x, y, z As Variant
Dim w As String
Dim chr(100) As String
Dim num1(100) As Integer
Dim num2(100) As Integer
Dim num3(100) As Integer
Sheets("TEST TSC").Select
-Range("A1").Select *<---------------- Run-time error '1004'*-
w = ActiveCell.Value
Sheets("Jan FTR").Select
Range("A1").Select
Range("E:E").Find(What:=w, Lookat:=xlWhole, LookIn:=xlValues).Select
ActiveCell.Offset(0, 2).Select
Do
chr(i) = ActiveCell.Value
num1(i) = ActiveCell.Offset(0, 1).Value
num2(i) = ActiveCell.Offset(0, 2).Value
num3(i) = ActiveCell.Offset(0, 3).Value
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop While ActiveCell.Offset(0, -2).Value = ""

Sheets("TEST TSC").Select
Range("A6").Select
i = 0
Do While ActiveCell.Value < ""
If chr(i) = ActiveCell.Value Then
ActiveCell.Offset(0, 3).Value = num1(i)
ActiveCell.Offset(0, 4).Value = num2(i)
ActiveCell.Offset(0, 6).Value = num3(i)
ActiveCell.Offset(1, 0).Select
i = i + 1
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
end sub

What can i do to fix this?????
If i comment it out, the error occurs on all the "Range" commands!!!!


--
hemants
------------------------------------------------------------------------
hemants's Profile:

http://www.excelforum.com/member.php...o&userid=15031
View this thread: http://www.excelforum.com/showthread...hreadid=266679



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
#N/A errors when matching time values excelent Excel Worksheet Functions 7 July 28th 06 03:35 PM
Run time errors famdamly Excel Discussion (Misc queries) 3 February 22nd 06 08:01 AM
Excel Run Time Errors baileyphil Excel Discussion (Misc queries) 2 July 21st 05 10:22 AM
Time Errors Benwin Excel Programming 4 February 10th 04 12:53 AM
Run-time errors Tom Lambert Excel Programming 0 July 31st 03 01:36 AM


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