Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Icy Icy is offline
external usenet poster
 
Posts: 10
Default Excel Macro Selection

Hello could anyone help, I worte a code which select record from same user in
the excel sheet and name the selection "First". Once run through all the
record, it will call selection "First" then copy and paste it onto the serach
result sheet. The code listed works fine until the user records are over
150. The function will give me a error "Run-Time error'1004':
Application-defined or object-defined error". Could anyone help, or any good
suggest on how to achive this.
Thanks so much.

Range(Cells(1, 1), Cells(1, 81)).Select
Selection.Name = "First"

For I=2 to Last
Name = Cells(I,3)
If (Name = Target) Then
Range(Cells(I, 1), Cells(I, 81)).Select
Selection.Name = "Second"
Range("First, Second").Select
Selection.Name = "First"

Next I


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Excel Macro Selection

For i = 2 To Last
Name = Cells(i, 3)
If Name = Target Then
Range(Cells(i, 1), Cells(i, 81)).Name = "Second"
Range("First, Second").Name = "First"
End If
Next i

Not a good idea to use Name as a variable.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Icy" wrote in message
...
Hello could anyone help, I worte a code which select record from same user
in
the excel sheet and name the selection "First". Once run through all the
record, it will call selection "First" then copy and paste it onto the
serach
result sheet. The code listed works fine until the user records are over
150. The function will give me a error "Run-Time error'1004':
Application-defined or object-defined error". Could anyone help, or any
good
suggest on how to achive this.
Thanks so much.

Range(Cells(1, 1), Cells(1, 81)).Select
Selection.Name = "First"

For I=2 to Last
Name = Cells(I,3)
If (Name = Target) Then
Range(Cells(I, 1), Cells(I, 81)).Select
Selection.Name = "Second"
Range("First, Second").Select
Selection.Name = "First"

Next I




  #3   Report Post  
Posted to microsoft.public.excel.programming
Icy Icy is offline
external usenet poster
 
Posts: 10
Default Excel Macro Selection

Thank you for your reply, it's still showing the same error message, it won't
let me go over 150 records, any idea, or better code that can achive this.
Thanks for help

"Bob Phillips" wrote:

For i = 2 To Last
Name = Cells(i, 3)
If Name = Target Then
Range(Cells(i, 1), Cells(i, 81)).Name = "Second"
Range("First, Second").Name = "First"
End If
Next i

Not a good idea to use Name as a variable.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Icy" wrote in message
...
Hello could anyone help, I worte a code which select record from same user
in
the excel sheet and name the selection "First". Once run through all the
record, it will call selection "First" then copy and paste it onto the
serach
result sheet. The code listed works fine until the user records are over
150. The function will give me a error "Run-Time error'1004':
Application-defined or object-defined error". Could anyone help, or any
good
suggest on how to achive this.
Thanks so much.

Range(Cells(1, 1), Cells(1, 81)).Select
Selection.Name = "First"

For I=2 to Last
Name = Cells(I,3)
If (Name = Target) Then
Range(Cells(I, 1), Cells(I, 81)).Select
Selection.Name = "Second"
Range("First, Second").Select
Selection.Name = "First"

Next I





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 can run a macro ( call a macro) on selection of any filtercriteria? [email protected] Excel Worksheet Functions 7 February 20th 09 12:34 AM
Default printer selection in Excel macro Charlie Excel Programming 1 April 3rd 06 10:16 PM
How can I get a macro in Excel to set the Zoom to "Selection"? GarryH Excel Discussion (Misc queries) 2 December 21st 04 01:44 PM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM
excel: activitaing a macro upon selection of a cell arunjoshi[_16_] Excel Programming 1 May 31st 04 12:52 PM


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