473,609 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

After changing to a new worksheet, vba excel breaks down

7 New Member
MS Excel 2000

It works fine up until the line [Range("EJ3").Se lect]
Here's the vba macro I have written for the button.

Expand|Select|Wrap|Line Numbers
  1. Range(ActiveCell, ActiveCell.Offset(0, -6)).Select
  2.    Range(ActiveCell, ActiveCell.Offset(0, 11)).Copy
  3.     Range("BE2").Select
  4.     Selection.PasteSpecial Paste:=xlPasteValues, _
  5.     Operation:=xlNone, SkipBlanks:=False, Transpose:=False
  6.     Range("BK2").Copy
  7.     Sheets("scoresheet").Select
' this is where is breaks down, after it switches to "scoresheet " it will not go to EJ3

Expand|Select|Wrap|Line Numbers
  1.     Range("EJ3").Select    
  2.     Selection.End(xlDown).Select
  3.     Range(ActiveCell.Offset(0, 1)).Select
What did I do wrong?
Feb 24 '11 #1
4 2232
Rodney Roe
61 New Member
I'm not sure what's going on but you can shorten up those last three lines like this, if you're interested.

Expand|Select|Wrap|Line Numbers
  1. [EJ3].end(xldown).offset(0,1).select
  2.  
Feb 24 '11 #2
Guido Geurs
767 Recognized Expert Contributor
I get no error with
Expand|Select|Wrap|Line Numbers
  1. [EJ3].End(xlDown).Offset(0, 1).Select
Is the name of the sheet OK ?
Expand|Select|Wrap|Line Numbers
  1. Sheets("scoresheet").Select
Feb 25 '11 #3
Greg Sovan
7 New Member
it switches to the sheet correctly, but doesn't go to the assigned cell. i tried it with another sheet, and the same thing. it switches to the sheet then yellow highlights the cell reference with a debug.
Feb 25 '11 #4
Rodney Roe
61 New Member
Question, Is your sheet protected? If it is you won't be able to select a cell unless you unprotect it.
Feb 25 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1348
by: Robert-Paul | last post by:
Hi there. I have a problem after changing the assembly name of a class library. I have two projects in one solution: - a Windows application (.exe) - Class Library. There is a references from the windows application to the class library. All the classes from the both projects are arranged by the same namespace.
1
1805
by: Napo | last post by:
Hi I use a c# method to open an excel file and to read it's data.But i find a problem that if i changed the excel file data manually by using excelapplication,the readed data by c# method isn't the modified data,it's old data still! I think that maybe caused by c# use a data cache . How to refresh it or how to read the true excel file data?I don't want close my app Thanks
3
1383
by: luna | last post by:
is there a way of changing the state of a drop down list to a text box depending on criteria ? i could create a drop down list and a text box list in the same posistion and change the visibility on criteria - just wondered if there was another way thanks
0
1190
by: Isabelle | last post by:
Hi I have posted this in the microsoft.public.frontpage newsgroups. Since it involves both Frontpage ext. 2002 on a windows 2000 Advanced's web server, and ASP.Net (framework 1.0), I decided to post here too. So here is the post I sent on the other newsgroups, please read and tell me if you have seen this. Note: By the way, here the developers don't have the choice, they have to use FP to deploy.
3
2072
by: Agnes | last post by:
Dim dsExcelExport As New System.Data.DataSet Dim daExcelExport As New System.Data.SqlClient.SqlDataAdapter Dim Excel As New Excel.Application Dim strExcelFile As String Dim strFileName As String dsExcelExport.Clear() daExcelExport.SelectCommand = New SqlCommand daExcelExport.SelectCommand.Connection =
0
1763
by: milkyman | last post by:
Hi everyone, Hope you can help me with this. I want to know if there is a way to copy a part of an Excel worksheet en put this as an picture in a picturebox. So if have got a Excel sheet(called Sheet1) and it contains some info. I want to select range A1:C12 and put a copy of this range in a picturebox i made on a UserForm. Is this posible and how do i do this. Thanks for helping me....
2
3318
Chittaranjan
by: Chittaranjan | last post by:
Hi All, I have a problem and hope I can get the better solution from here. I have a form written in HTML and I need to write that in perl so the main problem I am facing is that I need to generate some fields according the data I will select from the drop down list so basically I have drop down list which will ask for the number of students information I want to enter and after selecting a value from the number of students drop down it...
18
17934
by: questionit | last post by:
Hi Can anyone tell me how to create a drop-down box in Ms Excel please. I simple one which can have in it some values. Hope you understand.. i am not sure what is the difference between drop-down menu/box and combo box. but it is reuqired in ms excel. thanks user__786
5
1461
by: liquid106 | last post by:
Hi I'm using the following code in an Excel 2003 (Windows XP) Macro to populate formulas down the rows of a spreadsheet a certain number of times (variable - numContacts). Everything works fine to begin with as the macro adds rows very rapidly, but after about 3000 lines, it starts to slow down. nunContacts is around the 22,000 figure so with this number of rows to add to two tabs on a report, it takes roughly 16 hours to finish the macro...
0
1496
by: titojermaine | last post by:
The problem is that after reducing MSDTC security to "No Authentication", it mostly seems to work correctly, except that after a brief period of inactivity (a few minutes), the first attempt to use DTC fails, but subsequent attempts are successful, until inactivity again. The original environment was a single machine with SQL Server installed and a service on another machine that would connect to the same SQL Server but utilizing different...
0
8130
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8573
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8222
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8406
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2531
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1389
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.