Selecting Specific Worksheet Immediately Stops Macro

Nov 15, 2013

Whenever I try to use Sheets("Volumes").Select or .Activate on a specific worksheet, my macro code will immediately terminate with no error message. Iv'e used F8 to step through several modules and found that this happens every time it hits that line. The wierd thing is that i can select this sheet when screenupdating is off and I select it from a called subroutine. No other worksheets in this workbook are having this problem.

Additional info : using Sheet1.Select will select it with no issues but I don't want to go this route since it's a workaround and not a solution to somthing that should work.This problem occurs in several modulesEverything used to work fine and just one day it decided that i couldn't select the "Volumes" sheet in VBA anymore.I can click on the sheet no problem and it is not protected or hidden.

View 1 Replies


ADVERTISEMENT

VBA Code For Selecting Specific Cells Within Worksheet?

Aug 28, 2013

know the VBA script to select only specific cells within a worksheet. To be more precise, on sheet 1 - A2, A6 and A10 cells are filled with red color. I want only those cells which are highlighted in red to be selected, copied and pasted to sheet2.

View 3 Replies View Related

Selecting All Data In Specific Columns Without Selecting Adjacent Column

Mar 10, 2014

Using VBA, I need to Select A1:C14.

The problem is that A1:C14 contains blank cells, and there is also an adjacent column D that I do not want to copy.

So, UsedRegion and CurrentRegion aren't doing it for me. (It selects Column D too.)

Obviously, this is an example...the real data set is an export and varies in size.

View 1 Replies View Related

Macro To Copy Six Specific Columns From One Worksheet To Another Worksheet

May 12, 2008

What I am trying to do is to write a macro that will automatically copy six columns from worksheet (Sheet 1) to another worksheet (Sheet 2). i.e. ‘Description of Project’, ‘WBS Code’, ‘Rate’, ‘Employee Name’, ‘Premium’, ‘Invoice’, ‘Status’, ‘Total Cumulative Hours’, ‘Total Cumulative Amount’ from Worksheet (from Sheet 1 to Sheet 2)

The problem arises as I know the names of the columns to be copied in Sheet 1 (as details above) but they can be in any order in sheet 1.

In additional the columns ‘Total Cumulative Hours’, ‘Total Cumulative Amount’ are total columns so when they are copied from ‘Sheet 1’ to ‘Sheet 2’ their values should be copied as opposed to the formulas

View 9 Replies View Related

Macro Stops Running The Macro Completely And Hangs In The Middle

Jul 3, 2007

Here in our department we made a pretty elaborate macro that takes a report and sorts them out to 17 different sheets in a one workbook. This Macro pulls a file from a specific location on our server and then opens the CSV sorts it out color codes all the important information and saves it back onto the server under you specific initials.

They are four PC's along with our Managers laptop that run this Macro daily.

About 3 weeks ago my Managers laptop stops running the Macro completely and hangs in the middle of the whole thing. Eventually crashing Excel.

We try to remove the modules and re-import them back into the personal macro workbork but this does not work. The Macro's did not change and still fully function on the other four desktops to this day.

I uninstall Office on my Managers laptop and reinstall. Import the Modules again and still hangs up in very same spot it did 3 weeks ago.

I've tried to lower the macro security to the lowest level also and I've still had no luck with this laptop. I don't understand. The Macro's function perfectly on other PC's but will not function on this laptop.

View 9 Replies View Related

Macro Stops In The Last Row

Feb 25, 2009

The macro stops in the last row - it isn't able to select a cell in another sheet than "Menu" (I tested it different variations).

View 9 Replies View Related

Run Worksheet Specific Macro Only On One Sheet?

Apr 15, 2014

I'm trying to add some code so that it only runs on the specific sheet or a range of specific sheets - but this list might change in the future) as a worksheet event... When I have been doing this in the past, I have been copying the code to each of the individual sheets but this now seems to be incorrect.

This time, though, I have created the code on one sheet (with a Private Sub Worksheet_Calculate() event) which launches a macro in a separate module - my logic being to have as little code as possible in each of the sheets for copying, pasting, editing purposes, and centralise the main code in the module. However, I've noticed that this code is actually being run on all the sheets - even those I do not want it to run on. I thought, while developing this code, that it would only run on the one sheet it had been added to (e.g. right click the worksheet name, view code).

View 7 Replies View Related

Opening Specific Worksheet Using Macro

Mar 6, 2014

I'm having a problem to use the macro for opening a specific worksheet in a workbook. My plan to setup the workbook to open the first worksheet no matter which worksheet that was last saved and close.

What i have in mind is like below macros but it is not working.

Private Sub Workbook_Open()
Worksheets("Main").Activate
End Sub

Attached is the sample for the workbook. Test file.xlsm‎

View 3 Replies View Related

Macro Stops Before Completion?

Apr 13, 2014

i ran some tests and it was working good only doing folders with ~100 files. i tried running the macro on all the files (~70,000), but I ran into problems with the computer going into standby while I was away. I tried running a batch of 3000 files and it completed, but only got up to around ~400 out of ~3000 records. Maybe, it stops cause of code related inefficiencies?

Here's the code:
macro_forexcelforum.txt

View 1 Replies View Related

One Macro Stops Another From Working

Dec 2, 2011

I have this macro which sits in the workbook module:

Code:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range)
Static OldRng As Range

On Error Resume Next
If Application.CutCopyMode = xlCopy Or Application.CutCopyMode = xlCut Then
OldRng.EntireColumn.FormatConditions(1).Delete
OldRng.EntireRow.FormatConditions(1).Delete

[Code] .......

It's used to highlight the selected/active row.

But, as soon as I run another macro, it simply stops working entirely and I'm left with a row permanently highlighted until you manually remove the conditional formatting. All formats and cell colours controlled in the other macro stop working as well. This is the other (edited for publishing) macro, which is used to send an email, and is found in a module:

Code:
Sub Send_Mail()
'this sends an email that sends a text message

Dim OutApp As Object
Dim OutMail As Object
Dim MyButton As String
Dim strTo As String

[Code] .......

I didn't write the first macro so I'm not sure where the problem is? I'm guessing there is something in the code that is stopping it from working (i.e. running conditional formats) as soon as another macro is run? Is that was is happening?

View 5 Replies View Related

Macro Stops When Using Shortcut Key?

Dec 10, 2013

I have a macro stored a module at Personel workbook and i am using personel workbook as a hidden one. when i assign a shortcut below macro it is not working but whrn i am press F5 at VBA Editor it is working.

Here is the code:

Code:
Sub Transferdata()
On Error GoTo err1:
Application.DisplayAlerts = False

[Code]....

View 7 Replies View Related

Macro Execution Stops

Mar 12, 2009

I have a problem with the following code

Dim strProcLine As String
With ActiveWorkbook.VBProject.VBComponents(ActiveChart.CodeName).CodeModule
' MsgBox ok

' adaugat procedura goala
.CreateEventProc "Calculate", "Chart"
'MsgBox ok
strProcLine = "Format_Chart"
' MsgBox ok
.InsertLines .ProcBodyLine("Chart_Calculate", 0) + 1, strProcLine
' MsgBox ok
End With
' MsgBox ok

This is part of a larger macro, wich makes 2 pivottables and for each PT a chart, and for each chart i create an even procedure (Chart_Activate) wich calls a procedure to format the chart. Tha macro is alocated to the click even on a button in the sheet where i get the information from.

If i run the macro(click the button) with Microsoft Visual Basic Editor opened all goes ok. But if i close Microsoft Visual Basic Editor and then run the macro it stops right before .CreateEventProc "Calculate", "Chart" of the first chart , and i can't understand why. No error mesages delivered, nothing.

View 9 Replies View Related

Data From Specific Cells To Another Worksheet - Macro

Aug 31, 2009

I am looking for a macro which will take specific data from one sheet to the 2nd. I have attached the sheet. The Input data in the 1st sheet and the consolidated dat ain the 2nd one. Kindly assist. In the Final Sheet:

The Description column shld contain the data from B7:C7 and the B10:C10 together in one cell and that shld be copied till the end

The Description (Design steps) and Expected Result coulmn shld take data from the Test Step Description and Expected Result. And the Step Name shld be counted automatically till the last input. Test Name column shld be the 1st woksheet name.

View 4 Replies View Related

Macro That Will Save Data To Specific Worksheet Tab

Feb 22, 2012

I've been using this macro to pull data from multiple files, but instead of it creating a new tab, how can I have the macro pull the data and save it on a specific tab name(ex. Comp Stores). Here's the code I have currently.

Private Declare Function SetCurrentDirectoryA Lib _
"kernel32" (ByVal lpPathName As String) As Long
Sub ChDirNet(szPath As String)
SetCurrentDirectoryA szPath
End Sub
Sub Combine_Workbooks_Select_Files()
Dim MyPath As String

[code]....

View 1 Replies View Related

Macro When Selected Will Take Me To A Specific Row And Column In Another Worksheet

Feb 28, 2008

I want to create a macro that when selected will take me to a specific row and column in another worksheet, this will be the outcome of two cells, so far i have it to take me to the row but no reference to the column can anyone help.

code i have so far.

Sub Find_Todays_Date()
Dim FindString As Date
Dim Rng As Range
FindString = Sheets("Dynamic Whereabouts").Range("B1:B1")
With Sheets("whereabouts 08").Range("A:A")
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _

View 9 Replies View Related

Macro Stops At End Of Designated Range?

Apr 11, 2013

Problem with the attached Range Overrun.xlsm.

Form opens with set number of rows. End User then enters figure into C3 of how many row are to be added.

VB:
Option Explicit
Dim c As Range
Dim j As Integer

[Code]....

Macro works correctly by adding the number of rows listed in C3. It SHOULD then "name " various cells in the original and new rows.

BUT the Macro goes ON to name cells in rows BELOW the ones that are added.

So on the attached worksheet the original rows were 6 - 9. Rows 10 - 12 were added, but the macro names the cells from Rows 6 - 14.

View 2 Replies View Related

Saving As Stops Macro Working

Feb 6, 2008

i have a worksheet named for example 'allocation 1' this is a master document and is opened and modified and 'saved as' under a customer name. This then stops a few important macros working properly because they refer to the original title and not the new saved title. Is there any code that will let the macro recognise any new title it is saved under?

View 10 Replies View Related

Protection Stops Macro From Running

Jun 10, 2008

I want to make the worksheet protected, however, when I protect the worksheet the macro will not run.

View 14 Replies View Related

Spaces In Sheet Name Stops Macro

Sep 28, 2011

I've had a macro running for ages, and just found it bugs out when there are spaces in a sheet name.

The user selects a destination cell as part of a form, which passes the variable to the following steps:

Code:
looperx = 0
Do
looperx = looperx + 1
Loop Until Mid(celldestinationstring, looperx, 1) = "!"
Sheets(Left(celldestinationstring, looperx - 1)).Select

The purpose of which is to isolate the sheet name from the cell reference, which is typically like: 'Bob Sheet'!$B$9

This works fine where there are no spaces, but 'dies' with a runtime error when there are. With the apostrophes I assumed it would work around spaces in the string but I can't get it to work.

View 8 Replies View Related

Find Replace Macro Stops After Row 37

Oct 2, 2008

Here is the find / replace vba I am using.

Sub Replace()
Cells.Replace What:=Chr(19), Replacement:="-", LookAt:=xlPart
Cells.Replace What:=Chr(24), Replacement:="'", LookAt:=xlPart
Cells.Replace What:=Chr(145), Replacement:="'", LookAt:=xlPart
Cells.Replace What:=Chr(146), Replacement:="'", LookAt:=xlPart
Cells.Replace What:=Chr(160), Replacement:="", LookAt:=xlPart

End Sub

It makes the replacements up to line 37, then stops. If you then delete the first 37 rows and re-run the macro, it again performs replacements, but only on the next 37 rows.

I would like the macro to do the whole sheet...

View 9 Replies View Related

Macro Stops After Opening A Given File

Jul 10, 2006

I am wirking on a macro which opens a 'sourcefile' and then do some filtering and vlookuping to distribute the data to several files. When i run the macro from the VBA editor, everything runs fine. But if i run it from .xls file, the macro stops after opening the 'sourcefile'

Workbooks.Open Filename:=sourcefile
For i = 0 To 13
'do something...
Next

View 9 Replies View Related

Macro Stops Running Via Shortcut Key

Oct 20, 2006

Can't run vba macro. I have the following problem with a macro in excel. i wrote it, the macro runs very good from excel /tool/macro/macros/run, i also put a button on toolbar -it works too, i want to assign a keyboard shortcut from tool/macro/macros/options / shortcut and THE MACRO RUN INCOMPLETELY (stops running ).

Actually the macro opens all files in a specific folder, and delete their codes as follows:

Sub delete()
Const strNotFound As String = "There is NO Excel files..."
Dim ffTmp As FoundFiles
Dim wb As Workbook
Dim objVbc As Object
Dim objFile As Variant
Dim lngRet As Long
Application.DisplayAlerts = True
'Search Excel files
With Application.FileSearch
.NewSearch
.LookIn = "C:Corectii\_CS"
.SearchSubFolders = True
.FileType = msoFileTypeExcelWorkbooks...............

View 7 Replies View Related

Macro Stops After Workbooks.Open

May 16, 2007

In the last week the following code has ceased to work, and I do not know why:

If TradeShow = True Then
ReportFile = " ANALYSIS PRINT (CS+T) MASTER.xls"
Else
ReportFile = "ANALYSIS PRINT (CS ONLY) MASTER.xls"
End If
Workbooks.Open Filename:=ReportFile, ReadOnly:=True
Worksheets("TRANSFER DATA").Select
PriceFile = "PRICE COMPARISON.xls"

The Workbooks.Open command executes, and the screen shows the cells of the new spreadsheet. Nothing else happens, and the cursor is sensitive to operator control, showing that Macro control has been lost. I have inserted a test 'MsgBox' after the .Open command, and not even that is executed - so I am certain that the .Open is in some way wiping out the Macro.

View 9 Replies View Related

Macro Stops After After Opening Another Workbook

Sep 3, 2007

I am a novice at excel macro programming. My Excel 2000 macro inexplicably stops after the line: Workbooks.Open Filename:=stAddrFullname, ReadOnly:=True

1) I know that the remainder of the code is not executed because a breakpoint on the following line is never reached.
2) I know that this line is executed because the stAddrFullname workbook is clearly opened and is displayed when the code stops prematurely.
3) No error message is displayed and I have no 'OnError' instructions in the code.
4) (This is the bit I really don't understand). If I put a Breakpoint in the macro anywhere in the function preceding the "Workbooks.Open" statement, the macro reaches the Breakpoint and then runs through to completion with no problem. When I remove the breakpoint, it reverts to stopping as soon as it has opened the Workbook.
5) The stAddrFullname workbook has no macros in it.

View 5 Replies View Related

Macro Code Only Works If Specific Worksheet Active

Apr 30, 2008

I have searched the FAQ's but have not found a suitable answer to my problem. I have some code that works perfectly when it is run from the VB Editor but when I put it behind a command button it gives me an error almost straight away. I have read that when a command button is used the command button defaults the active sheet to the one that it is one therefore you always have to specify the active sheet but I have done this so am still confused as to why it is falling over. Below is my code, I have commented where it is tripping:

Sub FormattingAcutalReport()
Workbooks.Open Filename:="H:Risk ReportingDaily TemplatesMF Consolidated Risk DAILY LIVE DATA FROM BO.xls"
Workbooks.Open Filename:="H:Risk ReportingDaily TemplatesDaily Non Banks LIVE.xls"
Dim myBorders() As Variant, item As Variant
Set SEGNSEG = Workbooks("Todays Reports.xls").Worksheets("Seg and Non Seg Bank Summary")............................

View 2 Replies View Related

Macro Stops Every Time It Deletes A Sheet

Oct 15, 2008

I have a macro that that stops every time I’m trying to delete the sheet. I get this message. “Data may exist in the sheet(s) selected for deletion. To permanently delete the data, prese Delete.” and I have to manually click “delete” to continue running the macro. How can I avoid this stop so that macro runs thru it without stops?

View 2 Replies View Related

Macro Leaves Page Where It Stops Running

Oct 18, 2008

I have a Macro that changes the background colour cells dependant on the value in another cell, all seems ok but when it runs it scrolls the page as it shades the cells and then exits leaving the sheet where it scrolled to.

Is there a way to get it to return to where it started or not to scroll?

View 14 Replies View Related

Macros Running Twice: SaveAs Macro Stops

Jan 28, 2009

I have been working on some Macros. I am compiling a macro that runs other macros. I have two noticeable problems.

1 - My SaveAs macro runs fine by itself. But when called or ran by another macro, (which calls more than one macro) the SaveAs macro it stops.

2- Many of my macros, when ran by another macro (which runs more than one macro) cycles through twice.

My specific question is about no. 2 and the following are the individual macros and the macro that runs them.

View 2 Replies View Related

Macro Stops At 1st Line Of Userform Code

May 10, 2006

I have built a small userform with 3 fields. The macro ran OK first few times. Now, when user enters data in the form and clicks OK nothing happens. I found that repeated clicking on OK or Cancel button on form had no effect. I then observed that VBA editor was open and the yellow cursor was displayed on the first code line under cmdOK_click procedure. The code line was also highlighted in yellow. There are no errors to debug and no break points etc. When I clicked the Run (or Continue) icon from the VBA toolbar, the macro completed OK. Question: Why is the macro pausing on the first line and how can I make it run without pausing for no apparent reason.

View 4 Replies View Related

Macro To Copy Data From Specific Columns And Rows To New Worksheet?

Apr 29, 2014

What I am trying to do is to look at specific columns, then copy the data in that column from specific rows from sheet 1 (named TIA) to sheet Macro1. I think uploading a sample of the spreadsheet would be useful.

Unfortunately the spreadsheet is a living document and continues to grow in both column and rows.. The data extracted at this point is from row 7, 23-60 and copied into the new worksheet starting at A1.

Requirements:

1) Row 5 states the macro the column will be associated with. There can be more that one macro associated to a column.

2) When column is found, data from row 7 column (x) will be copied to sheet macro1 EX. If Cell G5 = macro1 then copy data from G7 to sheet macro1 at A1

3) When column is found, data from row 23 column (x) will be copied to sheet macro1

4) repeat requirement 3 till no more Scenario's

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved