Step Through Works But Not When Activated

Sep 24, 2007

I have written this code to change the colour of a row of cells to bright green and to change the cell contents of cell(Row, 15) from “L” to “F”: This is the main workbook into which are pulled values from three others. I then want it to open one of the subsidiary workbooks, that feeds the information, to change the same job row to bright green and to change the cell contents of cell(Row, 15) from “L” to “F”. Then I want to save the changes and return to the main sheet: - The ActiveCell contains the Job Number.

Option Explicit
Public rw As Integer
Public Col As Integer
Public Job As String
Public JobNo As String
Public RowNo As Integer
Public wName As String
Public times As Integer
Public Pips As String
Public Nicolas As String
Public Cindys As String
Public wb

Sub FinishedinOfficeCindy()
.
rw = ActiveCell.Row
JobNo = ActiveCell
Col = ActiveCell.Column
If Col 1 Then
Check that the correct
MsgBox "Please choose the Job Number first"column is selected and
Exit SubThat the workbook is
End Ifthe correct one
If Cells(rw, 14) "Cindy" Then
MsgBox "Wrong Secretary Chosen - whoops!"
Exit Sub
End If

All works perfectly when I step through it but, when it is activated (Ctrl+Shift+C) it opens the other workbook and then seems to end? I even tried putting in delays to see if they would help but they didn’t.

View 9 Replies


ADVERTISEMENT

Workbook Merge Works When Step Through But Not On Run?

Oct 8, 2011

The following code was working for me and now no longer works. Also, it works when I step through but not when I run it normally (it stops at the line imeediately following this line:

OrigWB.Sheets("PP&E").Move after:=DestWB.Sheets(DestWB.Sheets.Count) ) regardless of what code it is - even if it is only a message box.

The error message is code execution has been interupted.

******************
Sub PPEMerge()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.StatusBar = "Merging..."
'retrieve source docs:
'PP&E sheets from sec packages
'system beginning and ending balances

[code]....

View 1 Replies View Related

Macro Executing Step By Step

Jun 5, 2008

I don't know what exactly is happening, but every step of the macro is happening every 1 second. Literally, the BPM is 60. It will execute a step in the macro every second, when in other macro's i've made, it zips right through as if it was on fast forward.

View 9 Replies View Related

Can Workbook Be Activated Without Unhiding It

May 8, 2013

I have a macro that activates and copies data from a hidden workbook. The problem I'm having is that when the macro is done, the workbook is no longer hidden.

I used this code here to "re-hide" the workbook...

Code:
Windows("Macros.xlsm").Visible = False

...but now, everytime, it asks me if I want to save the changes to my workbook. I would like to copy a worksheet from this hidden workbook without having to worry about whether to save changes or not everytime I run this macro.

View 9 Replies View Related

Run A Macro When A Cell Gets Activated

Sep 25, 2007

how do i run a macro when a particular cell in the worksheets gets activated.

View 9 Replies View Related

VBA Ban, If Not Activated Defined Column

May 12, 2009

VBA ban, if not selected one of cells in defined column.
How to do it?

View 9 Replies View Related

Pop Up Activated On Clear Contents Code

May 20, 2009

I have a small workbook that copies 4 cells to a database list as per the code below, 2 of the fields activate a pop up calendar for date input on a button push the data is transfered to the sheet and the cells are cleared, however on the clear contents parts at the bottom of the code it reactivated the pop up calendar,
is there a way of not having this pop up when clearing the contents.

View 4 Replies View Related

VBA - How To Extract A Value From Cell In Non-activated Worksheet

Mar 18, 2012

I found something similar here VBA - How to select a range in a non-activated worksheet but when I tried to "apply" it, I kept getting an error if the relevant sheet wasn't activated. My code

Code:
Dim SearchRange As Range, FindRow As Range
Dim column As String, search_string as string
column = "K"

[Code]...

What I want to do is to be able to search for a specific value in a specific column on the "Combo boxes" sheet, which isn't activated (the number of rows will never be large, thereof the hard-coded 200).

I get the impression that some sites say the relevant sheet has to be activated, others say it doesn't.

The code above works fine if the sheet is activated, otherwise it fails with error 91 on the msgbox row.

View 6 Replies View Related

Method Returning Activated Object Name?

Aug 23, 2006

How do I add multiple worksheets at once after opening a new workbook? I was able to go to Insert>Workbook but it only adds one sheet at a time. I I need to add 50 woorksheets, I don't want to really click 50 times.

Insert a new worksheet
To add a single worksheet, click Worksheet on the Insert menu.
To add multiple worksheets, hold down SHIFT, and then click the number of worksheet tabs you want to add in the open workbook. Then click Worksheet on the Insert menu.

When I hold down the shift button and enter 50 i get the "%" and ) sign entered on the open workbook and then I try to click worksheet from the insert tab and it is greyed out.

View 4 Replies View Related

Macro Activated On A Time Basis.

Feb 27, 2007

I have an Excel file in which a Macro function is triggered by pressing a push-button. I need the Macro function to be executed on a time basis (say 10 sec) instead of upon an external action. Can it be done?

View 2 Replies View Related

Unique Values Should Listed In Sheet 2 And 3 Every Time When Activated

Sep 16, 2012

I have below set of value in Sheet 1 (it has category & Name), whenever I open the Sheet 2 & Sheet 3, unique values should get automatically posted in D column..

Category
Names

Pet Animal
Dog

Pet Animal
Cat

Wild Animal
Elephant

[code]....

I have two requirements on this..

1. Unique names should listed in cell D of Sheet 2

2. Unique value of both category & name should listed in Cell D of Sheet 3

View 1 Replies View Related

Excel 2007 :: Conditional Formatting For Cells That Are Activated?

Sep 26, 2013

Is it possible to set a conditional format for the following scenario:

a user clicks on or tabs over to A1 making A1 the "active cell". Once the cell is "active", a message appears in A2?

(Excel 2007)

View 5 Replies View Related

Create Unique List Each Time Worksheet Is Activated

Jan 13, 2008

I am getting a run time error 1004 during a copy-paste of a named range. I've read other posts and the help file and know it's related to defining an object, but I'm not clear on exactly what hasn't been defined.

Private Sub Worksheet_Activate()

Dim lCell As Range
Set lCell = Worksheets("Sheet1").Range("C65536").End(xlUp).Offset(1, 0) ' find first blank cell in the column

With Worksheets("Sheet1").Range("AllDates") 'filter duplicate dates
. AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"E7"), Unique:=True
End With

Worksheets("Sheet1").Range("Dates_Filtered").Copy Destination:=Worksheets("Sheet1").Range("lCell") ' fails on this line
Range("Dates_Filtered").Clear

End Sub

View 3 Replies View Related

Automatically Sort Column When Sheet Selected/Activated

Jun 3, 2008

i want to automatic sort data very time i open the file or any change in column b.

i have data in column B from B1 to B100

how to collect data from Column B and place them in Column A star from A1 because Column B not Organized!

I mean B1 have data
B2 have null
B3 have data
B4 have nul .... etc

i want to display all Column B in Column A one by one to be Organized.

View 4 Replies View Related

Filter A List By The Criteria Selected In A Listbox, And Activated By A Command Button

Dec 14, 2009

I'm trying to Filter a list by the criteria selected in a listbox, and activated by a command button. My problem is the sort criteria. I have 11 regions, numbered 01EPS through 11EPS. Sorting by any of these criteria works just fine.

The problem is that I also want to be able to sort by ALL of the regions at once. I can do this by using a custom filter. I recorded a macro to see what the difference was, and it simply a matter of changing 01EPS to "=*EPS". However, adding that to my case list results in an error message of "Compile Error: Syntax Error".

View 2 Replies View Related

Using Step In A For Loop

May 7, 2006

I'm trying to run a loop that doesn't go through every value between the lower and upper bounds so am using Step at the end of the For line:

For j = 0 To s Step loop_step
'Does stuff in here - not relevant
Next j

The amount that is being stepped through is set as a variable previously - called loop_step, and works fine for small values (e.g. stepping through 10 at a time) but comes up with an error for 1000. I haven't checked how large the value needs to be before it creates an error, but I was wondering if anyone knew if there's a limit on the number you can step through? Otherwise I have no idea what's causing this problem!

View 6 Replies View Related

Vba To Step Thru And Edit Data

May 26, 2008

I get a report that I have to manually edit everyday. I've done some VBA, but not sure where to start with this one.

The attachment has two sheets, first is what I get and the second is what I want. I'll explain the process i have to go thru now and maybe I can get some help to automate it.

First
-Add the tech number to the first column for each job for each tech.
7988 us the first tech number.

-Then delete every row that isn't a job.
-Add a column with the install date.(report data near the top.)
-Add a column and populate it with the system, which is the sheet name.
Thats why its example.

View 14 Replies View Related

Getting Range To Step Through In A Loop

Apr 6, 2012

This little piece of code is where I'm having problems.

A36:A45 will always be the same.

The problem is in getting ("R2:AA2") to move to ("R3:AA3") ...

What needs to happen for the loop to work?

Code:
Worksheets("List").Select
Range("A36:A45").Select
Selection.Copy
Worksheets("Month").Select
Range("R2:AA2").Select

I've tried:

Dim rngDC as Range

then Set rngDC = Worksheets("Month").Range("R2:AA2")

So that I can later use rngDC = RngDC.Offset(1,0)

However, when I try rngDC.Select I get an error saying I can't select the variable that way.

Here's the complete code:

Sub Import()

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

With Sheets("Month")

[Code] ....

View 2 Replies View Related

How Can I Step Through Project Code

Dec 7, 2006

I am looking at the code in a MODULE, I can use "F8" to step through it.

But if I have no module just the main project code I cannot find a way to step through it.

View 9 Replies View Related

Single Step Window

Oct 31, 2007

I do have code, but this thing (which appears on the Excel window, not the VBE window) doesn't seem to be connected to any of my code.

What is this, and what caused it to suddenly pop up on me in Excel?

View 9 Replies View Related

Different Results When Running Vs Step Through

Jan 12, 2010

My workbook contains several worksheets with queries to external SQL Server database. All queries use background updates. Each query uses a parameter for the SQL query string. The parameter value is obtained from E2 Reports!B4. Manually changing this cell returns results on worksheet Job Summary in range("A6:K6"). This works great!Worksheet Order Details contains a list of job numbers in column B.

I wrote a VBA sub that loops through these jobs, changing E2 Reports!B4 for each job. I then call the Application.RefreshAll function. Finally, I copy "Job Summary!A6:K6" to a row on worksheet Order Summary. If the next job is the same order, I copy with a paste special to add the results.The problem occurs when running the VBA sub. If I step through the code, waiting for the RefreshAll function to finish, the correct values are returned. If I step through fast, without waiting for the RefreshAll, the values for some jobs are copies of the previous job, but other jobs are correct. If I hold the F8 key down or hit the F5 key, all values are the same as the first job.I've tried DoEvents, turning off screen updates, and turning off background updates.

Private Sub
Worksheet_FollowHyperlink(ByVal Target As Hyperlink) If Target.Name = "Order Summary" Then ' rj references position on Job Summary sheet Dim rj As Integer ' ro references position on Order Summary sheet Dim ro As Integer rj = 6 ro = 6 ' clear all rows Sheets("Order Summary").Range("a6:a65536").EntireRow.Clear Application.CutCopyMode = False ' turn off screen updating to avoid flicker..........................................

View 10 Replies View Related

Step Calculation Formula

Apr 14, 2007

I have a simple calculation - Say 0-6. What i need to do is, if the value is <7 place a 10 in the cell, or if the the value is <12 place a 5 in the cell, or,
lastly if the value is <21.5 place a 0 in the cell. Is this at all possible - as i can only do it with conditional formatting using colours at present

View 7 Replies View Related

Step Average Across Every X Columns

Mar 11, 2008

Is there a way to loop through a range of numbers, pick the first 24 columns, do some kind of caclulation for each column and row, the start again on column 25 for another 24 columns, perform the same calculation, go to the next set of 24 columns, etc?

I have tried using, for example, AVERAGE(OFFSET(range,0,0,24,24) and that correctly returns the average for the first 24 columns (range being the range of data I am using like D366:HK389). However, unless I manually change the starting column for the next set, it doesn't return the correct result. I have attached a sample data spreadsheet. There are 9 Locations in the spreadsheet where each Location contains a 24x24 matrix.

View 4 Replies View Related

Step Based Rebate Formula

Apr 4, 2013

I am having trouble with the code for this stepped scale rebate structure

$0 TO $50,000 NET PURCHASES=NO REBATE ISSUED
$50,001 TO $150,000=5% OF NET PURCHASES
$150,001 TO $1,000,000=8% OF NET PURCHASES
$1,000,001 TO $2,000,000=9% OF NET PURCHASES
$2,000,001 AND OVER=10% OF NET PURCHASES

I have the forumula for retro active to 50,000
=IF(O77<50001,"0",IF(O77<=150000,O77*5%,IF(O77<=1000000,O77*8%,IF(O77<=2000000,O77*9%,IF(O77>2000001,O77*10%,)))))

If the customer did 2.5 million. I need a formula that will multiply the first 150,000 by 5%, the next 849,999 @ 8%, the next 999,999 @ 9%, and the remaining 500,000 2 10%. I was thinking of using a min/max function.

View 6 Replies View Related

Disable A Step In A Macro Without Having To Delete It

May 21, 2009

How do I disable a step in a macro without having to delete it?

View 3 Replies View Related

How To Step Among Entries Of Autofilter Via VBA Code

Jan 25, 2014

While I try to create a sub - autofilter A column and select the...

- first entry (but not as a unique item, as data may changes weekly) once 1st item filtered - I'd do some function: sum weekly results, and keep only one row with the filtered item (paste special/delete rows)

- than step on next entry and do the same as before

- take these steps till the end of autofilter list, than remove autofilter.

.. with this action, I'd get the sum value of my weekly forecast on each individual items.

I've started as:

ActiveSheet.Range("$A$2:$BN$400").AutoFilter Field:=1, Criteria1:= _
"17963-E050LF"

But criteria should be like .. 1st entry ... 2nd entry ... last entry .. session end .. ?!

View 14 Replies View Related

On Error, Go Back A Step In Macro

Oct 7, 2008

I have a macro in one file which uses an input box where the user types in a subcontractor code to retrieve address and contact details from another file.

If the user inputs the incorrect subcontractor code, an error message box pops up. Currently the user then has to select a button in the original file to restart the macro at the input box stage.

What I want to happen is when ok is selected on the error message, to return to the input box so in my macro below where the error message says "An error occurred - you asked for a subcontractor that does not exist. Please try again." and the user selects OK, I would like it to return to the 'Enter the Subcontractor line and the "Please enter the Subcontractor code" input box reappears.

View 8 Replies View Related

Can VBA Create A Named Sheet In One Step?

Apr 27, 2009

My vb code currently creates a new sheet via "Sheets.add". This new sheet has the default name of "sheet1" which I rename as "tempSheet". I then populate tempSheet with data, save as a CVS file and then I remove tempSheet.

If I stay in my workbook and try to execute the code again, the default name of the sheet it now creates is "sheet2" and not "sheet1" - this is a problem becuase my code is trying to rename "sheet1" "tempSheet" and of course it cant.

View 3 Replies View Related

Step Through & Debug VBA Macro Code

Jun 11, 2009

I don't understand the relationships that are happening and what the final value would be if for example the PT was Red. I'm confused and was curious how four lines could all equal different values(highlighted).

UpUserPaint = UCase(RegPaint.Value)
Dim icount As Integer
LenRegPaint = Len(RegPaint.Value)

For icount = 1 To LenRegPaint
ValPAint = ValPAint + Asc(Mid(UpUserPaint, icount, 1))
Next icount

If PTRed.Value Then
ColorCompare = Abs(Pallet * (ValPAint + PrdtSeed - LenRegPaint))
ColorCompare = Abs( Round(ColorCompare / PrdtSeed - 7227, 0))
ColorCompare = ColorCompare And 6215971
ColorCompare = ColorCompare Xor 6215971.............................

View 4 Replies View Related

Step Based Commission Formula

Sep 7, 2006

I am having trouble with the code for this stepped scale commission structure.

Net Service
$1,1400

Step Scale Comm. %
$0-500 40%
$500-750 45%
$750-1000 47%
$1000-9999.99 50%

Final Commission Paid $ ?

View 7 Replies View Related







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