Beforedoubleclick Create Sheet Stops Working Intermittently

Apr 27, 2007

I am using a BeforeDoubleClick event to look for a worksheet name and if it exists, go to the sheet. If the worksheet does not exist, it is creates a new sheet by copying a hidden sheet and naming it using a name in a cell reference. It works for the most part, but I am finding that it is having an intermittant issue. Sometimes, when I double-click, it double-clicks the target cell for editing, and then it renames the active sheet to the cell reference rather than copying the hidden sheet. It seems to happen when I reach 35 sheets created, but not always. Here is the

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim WSname As String
Dim WScheck As Worksheet
Dim WScheckname As String
If Not Intersect(Target, Range("A5:L85")) Is Nothing Then
WSname = Range("L" & Target.Row)
On Error Resume Next
Set WScheck = Sheets(WSname)
If WScheck Is Nothing Then 'Doesn't exist so create it
Sheets("Master_SLP").Copy Before:=Sheets(Worksheets.Count)
ActiveSheet.Name = WSname.........................

View 5 Replies


ADVERTISEMENT

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

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

Code Stops Working After X Rows

Nov 23, 2008

I'm using Excel 2007 and my s/s is 360000 rows deep.
To cut+paste formulas+formats from one column to another I'm using the following
Sub move_formula_and_formats_from_I_to_L()

Dim cell As Range

Application.ScreenUpdating = False

For Each cell In Range("I1", Cells(Rows.Count, "I").End(xlUp))
With cell
If .HasFormula And Not .Offset(1).HasFormula Then
.Cut Destination:=.Offset(1, 3)
End If
End With
Next cell

Application.ScreenUpdating = True

End Sub
The code stops working after 159000 rows and highlights (in yellow) the line:
.Cut Destination:=.Offset(1, 3)

View 9 Replies View Related

Command Button Stops Working

Jun 13, 2009

I have a command button on worksheet2 of my spreadsheet, which has a macro assigned that will take the user to worksheet1 when it is clicked.

My problem is that when I hide worksheet1 using xlSheetVeryHidden - the maro seems to die and the command button no longer works.

View 9 Replies View Related

Active X Control Stops Working

May 16, 2006

I have joined out of desperation relating to a problem with an Active X control inserted into a userform. This control accesses and returns data from an instrument on the RS232 PC comms port. All works well until I try to save, copy or print the workbook using usual VBA code, then mysteriously the code just stops, and Excel needs to be restarted again. It seems to just get lost!

View 2 Replies View Related

Formula Stops Working After Performing Certain Tasks

Nov 21, 2006

I was given the following formula by Domenic some time ago that I use along with VBA code supplied by Fin Fan Foom to open do a lookup on a closed workbook:

=If(ISNUMBER(MATCH(MIN(If( Date=D2,If(ABS(Time-E2)<"0:30:30"+0,ABS(Time-E2)))),If(Date=D2,ABS(Time-E2)),0)),INDEX(Contact,MATCH(MIN(If(Date=D2,If(ABS(Time-E2)<"0:30:30"+0,ABS(Time-E2)))),If(Date=D2,ABS(Time-E2)),0)),"")
Everything works fine, until I attempt to…
- cut & paste a block of cells, or
- do a SaveAs, or
- change a worksheet name

The formula will no longer function after performing any of these tasks (the cells go blank), and I have to close the workbook without saving to preserve the original workbook functionality. All other tasks, including even importing of different files into the workbook have NO negative effect.

The formula uses an “INDIRECT” named range. Sheet name changes are reflected in the named ranges, but any change of names somehow causes a malfunction (no sheet names are referenced in the VBA).

I thought that the large lookup workbook (40,000 rows) may be a problem, but even after deleting most of the data and retaining only a few rows, the problem still remained.

After the formula cuts out (after performing the above tasks), if I open up the lookup file, then the lookup will work again, but if I close the lookup file, it will stop working.

I doubt the problem is in the VBA code since IT WORKS, and besides, I have other simple VLookups formulas that also uses the same process (and VBA code) and they continue to work just fine when that one formula gives out. The only thing I can think of is that the complexity of that one formula may be an issue.

Anyway, I the original thread is long, so I’m starting a new one here. The original thread is here (Domenic’s formula, pg 7; FFF’s code, pg 8):
Dedicated Cell To Choose Lookup Table

View 9 Replies View Related

Conditional Formatting Stops Working After Adding Column

May 21, 2013

I have a conditional formula that highlights dates red when it meets a certain criteria. The file named MS Working, the conditional formatting formula (formula below) works as it should with no issues. The other file MS NOT Working, the conditional formatting formula (formula below) has stopped working as it should. What I did? I inserted a new column to the left. Where the MS Working file has only 1 column to the far left, the MS NOT Working file now has 2 columns to the far left.

It seems as if the formula adjusted itself when I inserted the new column; however, its not working.

MS Working
Conditional Formula: =AND(TODAY()>B3,NOT(ISODD(COLUMN())),B3<>"",OR(C3="",C3=0),B3<>0)

MS NOT Working
Conditional Formula: =AND(TODAY()>C3,NOT(ISODD(COLUMN())),C3<>"",OR(D3="",D3=0),C3<>0)

View 3 Replies View Related

Excel 2013 :: VLookup Stops Working After Certain Number?

Jan 28, 2014

Excel 2013

Our company has a shipping report spreadsheet that has the job number in column A and the ship date in column F. I want to track other things on a separate spreadsheet. So far, we are only down to row 1440 so in order to account for future jobs, my code on the other spreadsheet is:

=VLOOKUP(A2, '[Shipping Report.xlsx]Monthly shipping schedule'!$A$1:$F$5000, 6, FALSE)

Also, the jobs are arranged by ship date, not by number order.

This has worked perfectly for months but for some reason, it will no longer recognize job numbers greater than 1331. The format is the same between the working and non-working cell. Is there a max limit for vlookups that I am not aware of? If this was a sudden failure, I could nail it down but there has to be an underlying reason I'm not seeing.

Here is a sample of my spreadsheet:
Ship Date
1325 12/27/13
1326 3/10/14
1327 1/4/14
1328 1/31/14
1329 3/3/14
1330 1/22/14
1331 1/15/14
1332 #N/A
1333 #N/A
1334 #N/A
1335 #N/A
1336 #N/A
1337 #N/A
1338 #N/A
1339 #N/A
1340 #N/A

View 9 Replies View Related

Create Folder & Export Sheet, Not Working

May 28, 2009

I was working on some code that would create a new folder in My Documents and within that folder export the current worksheet and save it there with a particular name. After doing so I need it to return to the original worksheet and clear contents. I would also need to export to the new sheet only contents of the cells without any macros or buttons.

View 5 Replies View Related

Excel Macro Stops Working In Copied Spreadsheet Within Same Workbook

Jan 4, 2012

I have a simple list of data (Name, Room, etc.) in a spreadsheet. Each day I click on the spreadsheet tab and create a "copy" and (move to end). This creates a spreadsheet for the next day's data.

My problem is that the macro I use to sort this data never works in the newly created spreadsheet within the same workbook. As usual, I'm sure it is something relatively simple that I am overlooking.

View 1 Replies View Related

Create A Loop Which Stops Once A Cell Is Empty

Mar 11, 2009

I am trying to create a loop which stops once a cell is empty.

Assuming I have declared proper DIM, my code is

Row=1

Do
Row = Row + 1
SheetName = Cells(Row, "A")
Sheets.Add.Name = SheetName
Loop Until IsEmpty(SheetName.Offset(1, 0))

View 9 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

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

ActiveX Click Control--STOPS When On Another Sheet

Nov 23, 2007

RE: Macro ActiveX Click Control--It stops when on another sheet

Macro runs OK when run from menu.

An activeX click button was put on sheet B.

Right click the control, View Code, Paste in code from macro, then click button.

It runs the part of the macro that applies to sheet B, goes to previous sheet A, and then stops. The range select line for the named range on sheet A is highlighted in yellow. It stops when selecting any range or cell on sheet A, like B2.

Any idea why this code does not work on sheet A when ActiveX button is on sheet B? Is there someplace else that the control can go? Using Excel 2000.

See part of code below, which starts on sheet B:

' Macro recorded 11/22/2007

Range("SortAll").Select
Selection.Sort Key1:=Range("T2"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
ActiveSheet.Previous.Select
Range("FormBase").Select (STOPS HERE)
Selection.Copy
Range("Formul").Select
ActiveSheet.Paste
ActiveSheet.Next.Select
FormBase is a named dynamic range
FormBase=OFFSET(A!$A$2,0,0,1,MATCH(1E+306,A!$2:$2))

View 9 Replies View Related

Loop To Delete Worksheets Stops After Deleting One Sheet

Mar 17, 2014

Sub DeleteSheetsPlease()

Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Application.StatusBar = "checking " & ws.Name

[code] .......

This skips "Parameters" and "About", then it deletes a single sheet (that does not match "Parameters" or "About"),

BUT THEN IT STOPS, leaving "deleting [WSNAME]" in the appstatus. It's like it skips the "Next ws" statement altogether after deleting a sheet.

I want it to keep looping on all the sheets, but that delete action seems to kill the looping...

View 2 Replies View Related

BeforeDoubleClick Exclude Range

Aug 22, 2009

I have the following code which toggles the value of cells by double clicking on them. I need to exclude certain ranges of cells though. I tried password protecting the sheet, but that haults the code. Is there a way to exclude the cells or exit sub if the targeted cell was in the range of Rows("10:10") or Columns("A:B") for example?

View 2 Replies View Related

BeforeDoubleClick But Preserve Original Cell

Sep 18, 2008

Within Worksheet_BeforeDoubleClick, I have the following simple code extract that sets the appropriate autofilter to the correct value (and highlights a couple of cells for clarity) when a particular cell is double-clicked...

If Not Intersect(Target, Range("C10:AQ11")) Is Nothing Then

If Not Intersect(Target, Range("C10:D11")) Is Nothing Then

Selection.AutoFilter Field:=10, Criteria1:="C"
Range("C10:D11").Interior.ColorIndex = 36

End If

You'll be happy to hear that the event works as expected.

However I would like to add the following enhancement: after Worksheet_BeforeDoubleClick completes the "double-clicked cell" is selected, is it possible for the "original" cell to be re-selected once the event completes?

View 9 Replies View Related

Several Cells Blank Intermittently

Jan 4, 2010

I have issue with blank cells in Excel...its happen intermittently, as it would be OK today and might not be OK tomorrow...no formula applied to these cells...

as you can see in the attachment, cell B6 is highlighted in the spreadsheet; it looks like a blank cell, but in the toolbar at the top, the value of the cell is correctly displayed as "Philip Goughary".

View 14 Replies View Related

Formula Returns Div/0 Error Intermittently

Jan 10, 2007

I'm using the formula below to count the distinct number of values in the range, many values are repeated so this formula only counts each one once, it works sometimes. For some reason I get a #Div/0 error once in a while.

The entire range might not always have a value, when I get the error if I add text to the remaining cells of the range the error is cleared.

I do not want to use a If (iserr(myformula),0,myformula)) because there are still values that need to be counted even if the range is not totally populated.

=SUMPRODUCT((B16:B1500"")/COUNTIF(B16:B1500,B16:B1500&""))

View 9 Replies View Related

Paste Special As Values Macro Only Works Intermittently

Feb 23, 2008

I often need to use Paste Special... Values, using Excel 2003. So I recorded a Macro into "Personal.xls" and assigned a shortcut key combination "CTRL-Shift-V" so that it would always be available. I first select one or more cells and hit CTRL-C to copy to clipboard, click on another cell, then hit CTRL-Shift-V to run the following macro: Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

It often works . . . and it often fails. When it is working it seems to keep working over and over. When it is failing it keeps failing. So it is almost as if there are two "modes" of operation, which for lack of terms, for this post I will coin the terms "fail mode" and "fixed mode". Once I am in one of the two modes, it stays there for a while. When it is in the "fail mode", I always get the dreaded: Run-time error 1004: "Pastespecial method of Range class failed".

Since this problem is very intermittent, I believe this is why there are so many posts in the Internet about this, and so many people are replying back "it works fine for me". I have seen many solutions offered but none work so far for just a simple shortcut key to do a PasteSpecial :Values. Some solutions "work" . . . such as adding the PasteSpecial button to the Toolbar, or pressing ALT-E-S-V <Enter> - but both of these bring up the Paste Special dialog box which I want to avoid. I spent days trying the many solutions offered but so far all I have found is a trick to convert Excel from "fail mode" to "fixed mode". The trick is to add a line to the macro to first do a "Paste Special: Format:

Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
...................................

View 8 Replies View Related

Excel 2003 :: Paste Special As Values Macro Only Works Intermittently

Feb 23, 2008

I often need to use Paste Special . .. Values, using Excel 2003. So I recorded a Macro into "Personal.xls" and assigned a shortcut key combination "CTRL-Shift-V" so that it would always be available. I first select one or more cells and hit CTRL-C to copy to clipboard, click on another cell, then hit CTRL-Shift-V to run the following macro:

VB : Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

It often works . . . and it often fails. When it is working it seems to keep working over and over. When it is failing it keeps failing. So it is almost as if there are two "modes" of operation, which for lack of terms, for this post I will coin the terms "fail mode" and "fixed mode". Once I am in one of the two modes, it stays there for a while. When it is in the "fail mode", I always get the dreaded:

Run-time error 1004: "Pastespecial method of Range class failed".

Since this problem is very intermittent, I believe this is why there are so many posts in the Internet about this, and so many people are replying back "it works fine for me". I have seen many solutions offered but none work so far for just a simple shortcut key to do a PasteSpecial :Values. Some solutions "work" . . . such as adding the PasteSpecial button to the Toolbar, or pressing ALT-E-S-V <Enter> - but both of these bring up the Paste Special dialog box which I want to avoid.

I spent days trying the many solutions offered but so far all I have found is a trick to convert Excel from "fail mode" to "fixed mode". The trick is to add a line to the macro to first do a "Paste Special: Format:

VB:

Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Then select and copy any cell/s, click on another cell, and run the macro just ONCE - it will paste the formatted value successfully and you are now in the "fixed mode". Now you can remove the PasteSpecial:Format line that you just added, to get back to the original macro with just the "Paste Special: Values" line:

VB : Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Now Excel is in the "fixed mode" and the original macro will once again start working properly. BUT only for a while !! Then some time later, usually within a day or a couple hours . . . Excel goes back into that "mode" where once again the macro fails repeatedly. I have been unable to isolate what causes the mode to return to failure.

Any simple way to either change the code so that it ALWAYS is successful, why this often is not successful ? I believe that the fact that adding in the Paste Special : Format code and running it just once to fix the problem, also could be a clue as to what causes this problem to "sometimes" occur.

View 9 Replies View Related

Macro To Create Hyperlink List Not Working?

Jul 10, 2014

I have a macro that would create a hyperlink for every one of the files in a folder that a specific cell gave the url address for.

Recently I got moved to a new pc and forgot to migrate my macro's over. In combing back through previous threads... I found the macro, but now it won't work.

[Code] ......

The error that I get is:

Compile error:
Invalid use of property

I get this error at row

Range (Cells(Rows.count, "U").End(xlUp).Offset(1, 0).Address)

Why did the macro used to work and not anymore?

View 6 Replies View Related

Need To Create A Button That Can Copy Cells, Create A New Sheet And Then Paste There

Jan 14, 2009

So I've got Sheet 1 with say

____A___B___C
1___m___i___c
2___r___o___s
3___o___f___t

I would like to create a button that can create a new sheet and paste A1 to C3 at the same location on the new sheet

and I need this to create a new sheet and do that everytime the button is pressed.....

View 11 Replies View Related

Concatif Function Breaks Beforedoubleclick Function Just By Being There?

Nov 19, 2009

I have a tracking sheet (attached) that has many functions, but I'm having trouble with two of them. First of all, I have a Worksheet_Change event set that when a cell is cleared, it fills the cell with a formula to use the record above it as a default value if another cell is equivalent. This worked when I first wrote it, but now it seems to break every other time I use it. When assigning the formula it returns a Method Default/FormulaR1C1/Offset failed error message. It seems to be different for each one, each time and I can't figure out what the problem is.

The other problem I'm having is that I wrote a BeforeDoubleClick event to expand or contract any given record, or series of records. this too worked when I initially wrote it, but now is only hiding one row when it should be hiding eight or more.
I'm not terribly versed in VBA and totally baffled as to why I'm having these problems. As I side note, any ideas to clean up any of the code and make this run smoother (as ther will be many more series added when complete).

View 5 Replies View Related

Copy Sheet & Create New Monthly Sheet From Present Sheet

Jan 12, 2010

I want to create a macro button that can create copy, insert, paste and rename the new sheet in next month's name, like if the active sheet's name is January, I want to copy the whole sheet of January, insert new sheet, paste the new sheet and rename the new sheet to next month like February?

Also rename the new sheet (February) cell B3 the same as new sheet's name (February)

So if month of February is near end, the macro button in February will create the same way as Jan did which means the next sheet will be named March and so on.

View 9 Replies View Related

Create Automatic List In Excel Sheet With Filtered Data From Another Sheet?

Dec 27, 2012

So I have a guest list workbook. There are two sheets. On the first one is a list of names on Column A. On Column B is a classification: 'C' if confirmed; "D" for declined; "I" for pending. I want to have all the names with "C" on sheet 1 appear on sheet 2 automatically.

View 4 Replies View Related

Macro Pull Data From Each Sheet And Create A Summary Sheet

Jan 26, 2009

I need to create a macro that will scan a spreadsheet for the number of sheets and then pull data from the same places on each sheet in order to create a summary sheet. Let me try to explain a little better.

The spreadsheet I'm working with has a separate sheet for each new deal our company makes. Each of these sheets is in the same format - we use a template and fill in the data based on that whenever a new deal emerges. The sheets contain basic info about the deal in the first few rows and columns, then some narratives with dates describing the progress of the deal, and then a list of issues and whether or not they have been resolved. The problem is, each of these sheets contains too much info for a quick, high-level overview with the bosses so they've asked me to create something that will pull the basic info, the most recent narrative, and any unresolved issues from each sheet. This way, each time there's an overview scheduled with the bosses, the macro can be run and it will create a new sheet with data from each sheet in the workbook.

View 9 Replies View Related

Automatically Re-name Sheet To Cell Value & Create Copy Of Hidden Sheet

Aug 10, 2008

I have a workbook with a hidden sheet ("Template") and a visible sheet("New Job"). I need code so when cell F1 in "New Job" is populated:

1-the sheet is renamed to the value of F1,
2-a new tab is made (a carbon copy of the hidden sheet "Template")
3-the new tab is named "New Tab" and marked as unhidden.

Public Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Name = Range("F1").Value
End Sub

Function WorksheetExists(SheetName As String, _
Optional WhichBook As Workbook) As Boolean
Dim WB As Workbook
Set WB = IIf(WhichBook Is Nothing, ThisWorkbook, WhichBook)
On Error Resume Next
WorksheetExists = CBool(Len(WB.Worksheets(SheetName).Name) > 0)
End Function..................

View 2 Replies View Related

Macro To Copy Current Sheet, Create, & Rename New Sheet From Current Open Sheet

Oct 27, 2008

EXAMPLE: Complete Sheet called "Day1". When day1 is complete you click on button and it then copies itself and creates and renames new sheet to "Day2", then when "Day2" is complete you click on button and it then copies itself and creates and renames new sheet to "Day3", and so on and so forth to "Day30".

View 9 Replies View Related







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