Return To Active Cell After Macro Run
I am using Excel to tabulate scores for my employees. We work in a very busy and open office, so there is a need to be able to obfuscate the scores, but also help keep from losing my place while punching the scores.
I would like it to be able to return to the last cell that I was punching a score in...I used "ActiveCell.SpecialCells(xlLastCell).Select". I have also used " x= cells(Rows.count,2).end(xlUP).row" followed by "cells(x+1,2).select", but both with no luck...
Sub Hide_Scores()
Range("B15:EU35").Select
ActiveSheet. Unprotect
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
Return User To Cell After Macro Has Run
I am writing some code where I will need to refresh data and do a few calculations while the user of the spreadsheet is working on the information. How do I write the code for VBA to record what sheet/ cell the user is currently on and then do i use the "GoTO" function to return the use to where he/she was when they left off.
View Replies!
View Related
How To Run Macro From Active Sheet
I have written the below macro to copy data from a sheet called "Fixit Example 1" to a sheet called "Fixit Summary Example". It works fine, but I'd like to be able to run it from any "Fixit Example XX" worksheet. As written, the data is always copied from "Fixit Example 1" regardless of what worksheet I have open. I tried replacing Windows("Fixit Example 1.xls").Activate with Windows(Active.Worksheet).Activate but got an error "Run time error 424. Object required." Sub MoveData() ' ' MoveData Macro ' Macro recorded 18/03/2009
View Replies!
View Related
Return Maximum Of Active Cell & Arbitrary Value To Cell
I am looking for VBA that will add the value of the current active cell on the sheet to the value in cell F12. The maximum value of F12 cannot exceed 1000. So if the value in F12 = 950 and 100 is the value in the active cell the maximum value in F12 should show 1000, not 1050. It should do this on the click of a button.
View Replies!
View Related
Macro To Print Active Area Excluding Cells With Forumula That Doesn't Return Value
Trying to put together a macro that looks down active sheet for all cells that contain a value, sets a print area and then prints ! Is this possible? FYG, I have a column that run from 3 - 2000, which contains a formula, which may produce a value depending on corresponding cells. I used this code from a post on a similar topic, but excel is complaining code in bold Private Sub Print_Area_Click() Dim lastCell As Range Set lastCell = Cells.SpecialCells(xlCellTypeLastCell).Offset(1, 0) Do Until Application.Count(lastCell.EntireRow) 0 Set lastCell = lastCell.Offset(-1, 0) Loop ActiveSheet.PageSetup.PrintArea = Range(Cells(1, 1), lastCell).Address End Sub
View Replies!
View Related
Return Active Cell's Location/row
I'm having trouble identifing a way to return a location for the position of the active cell. I've searched Excel help with "Position, location, return, activecell, etc." and I can't seem to figure this out. I know that it's possible, so that's why I'm on here! ... Ok, say the active cell is currently "F1", and I need the location "F1" to identify the ROW to be used in a formula later, how would I go about that? The current contents of cell "F1"' will be "REPLACE", but I need to change the words "REPLACE" in "F1" and other cells labeled "REPLACE" in column F to the following formula (where the "1" in "A1" is is the current row):
View Replies!
View Related
Return To Activecell Prior To Macro Run
I have a macro that selects various cells whilst it runs - nothing unusual there! What I'd like it to do is return to the activecell immediately prior to running the macro. So if cell 'B34' is active and then the Macro runs it currently returns to cell 'A12' (the last selection in the macro). I would like it to return to cell, in this instance, 'B34'. The activecell could of course be any reference within the spreadsheet, so whatever is active prior to running macro is returned to when macro is complete.
View Replies!
View Related
Can A Macro Start From Wherever Cell The Active Cursor Is On
Can a macro start from wherever cell the active cursor is on? or perhaps from the cell that the macro button is clicked? What I am trying to do is copy the data from F(whatever) to whatever the last empty cell is in the row holds the active cursor. Or I can create buttons for the macro to run, and it could copy the information in that particular row.
View Replies!
View Related
Return To The Last Active Sheet
I have a spreadsheet that is nearly 100 worksheets. I am new to VBA and would like to put a button on each tab to return me to the last active sheet. I've tried other codes I've found on here but with no luck. I'm not sure if i'm posting them to the right area within VBA.
View Replies!
View Related
Run Macro On Double Cell Click If Cell Part Of Named Range
I have a sheet where i have many differently named areas (like state1_1 and state1_2) When I doubleclick on a cell then a macro should run with following criteria: 1) Macro will run if the doubleclicked cell is part of any range in the list. Here I mean that names of ranges which belong to that list start with word state (like state1_1 and state1_2). No other ranges should not be in that list. If the cell is not in the range that is part of the list, then nothing should happen.
View Replies!
View Related
Pass Each Cell Value In Range To Cell & Run Macro Code
I have workbook template that I use to generate reports from a list of depts. This list is contained in a drop down cell that is a named range in a different worksheet. My current process is as follows: -Select Dept Name from the list -Click a command button which is assigned to code that calculates and saves to a file -Repeat for next report until all reports are generated I would like to automate this process by producing all reports with a single command with the following functionality: -The Dept Name needs to be populated in the specified cell containing the current drop down because it drive various vlookups and other formulas -If possible, I would like to retain the drop down functionality as I would like to have the option of running an individual report or running the “batch”.
View Replies!
View Related
Run Macro If Cell Value Greater Than 1
I would like the macro to run on its own if the cell value is greater than 1 i have data comming into the excel sheet using sql, and j1005 cell calculates the entire data displays 1 if condition of j1005 is met else display 0 . the data refreshes on its own and j1005 keeps check every time and display the value 1 or 0
View Replies!
View Related
Run Macro When Cell Selected
I've seen plenty of code for running a macro when various events occur, but how do I run a macro when a cell is simply selected? I have a calendar Macro, and there are two cells that need date input. I want the user to select the cell, and the calendar to pop up. Macro for the calendar works correctly, just need the code for the activation upon cell selection.
View Replies!
View Related
Run A Macro By Clicking A Cell
I would like to run a macro by clicking a cell. I don't want a toolbar button/menu item and Hyperlinks don't work. Can this be done? More info: My macro selects the current row in Sheet A and moves it (cut & Paste) to Sheet B in the workbook. The macro then goes back to Sheet A and deletes the now blank row.
View Replies!
View Related
Macro To Run When A Cell Changes On Different Sheet
I am tring to write a macro that will hide certain columns on sheet2 based on the value of cell a1 of sheet1. I have been able to get it to work when the input cell is in the same sheet. What I need for example is if someone enters 1 into cell a1 on sheet1 then on sheet2 the macro will hide column c to f. If they then enter 2 into cell a1 of sheet1 then sheet2 will unhide column c to f and hide column g to J.
View Replies!
View Related
Run Macro When Cell Is Selected
I just want to run a macro when a certain cell is selected. upon investigation, i have found that I can right click on the sheet tab and view the code. I can then add the following Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$a$1" Then run(macro1) end if End Sub
View Replies!
View Related
Cell Value To Run A Specific Macro
I have several macros that email a specific section of a workbook when I run it - I have an icon (image) per section. I want to be able to run a macro that calls one of these section specific macros based on a choice from a drop down list. It would work this way: - From the drop down in cell E11 I choose "New Jersey" - I would then click on the email image next to the cell (next to E11) - that macro would call the macro that emails the "new Jersey" section. I realize there might be a much better way, easier even. However, I already have the other macros written out and would just want to add this step.
View Replies!
View Related
Run Macro On Cell Click
i have macro that opens up a calendar and inserts a date. i'd like it to automatically run when a particular cell is clicked. i don't want it to run for all cells, just cells in a certain column.
View Replies!
View Related
Run A Macro On Cell Click
i have this piece of Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink) If Target.Range.Address "$A$1" Then macro1 Exit Sub End Sub I want so when i click on cell A1 it will run macro1. So far the click on the cell works, but it works with every single cell I click on. How to I get it to just work with cell A1 instead of everyone single cell I click on? Also, there are about 30 different cells that will run different macros, how would I go about creating adding the code the one above without having to create separate sub worksheets?
View Replies!
View Related
Run A Macro When A Cell <> Blank
I have a macro that runs when the user clicks on a button. I want it to run when a particular cell has data in it - after the user selects an item from a drop down. How can I make the macro trigger based on a cell being non-blank?
View Replies!
View Related
Only Run Macro When Cell Value Is Empty
I would like to have an alert msg to prompt the user whether he/she wan to proceed to run the macro upon the macro button is pressed. However the alert msg will only pop up if cell value, A1 is not empty. In the alert msg, The user will have an option to choose to run the macro and do not run the macro. Another question. I have a macro copy some data from other workbooks. I would like to alway return to a worksheet, named"Summary" after the macro is run. any way to do that ?
View Replies!
View Related
If A Certain Cell Does Not Equal Zero Then Run Macro
if a certain cell does not equal zero i want a macro to run. But i'm having trouble getting the logic right. here's what i have so far Private Sub Worksheet_SelectionChange(ByVal Target As Range) Range("u82").Select If Active.Selection 0 Then Call unhide_addABBR ElseIf Active.Select = 0 Then Call hide_addABBR end sub
View Replies!
View Related
Run Macro When Cell Value Alters/Changes
I have the code below that runs the macro BUYSELLSORT, this runs as soon as I click in the relevant cell BEFORE I have chance to enter new data into that cell. How would I alter it so that it allows me to select the relevant cell,enter the new values in that cell and THEN run the macro. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Row = 3 And Target.Column = 58 Then BUYSELLSORT End If End Sub
View Replies!
View Related
Run Macro Based On Cell Change
I am working on a training scheduler. In which a sheet contains the details of the trainings that are scheduled now i need that if any training is canceled then a mail needs to be sent (Status is updated in cell). I have code to send mail however the problem that i am facing is that how can i execute this macro when training is canceled. I did a search and found the following thread How to call a macro based on a value of cell? but the code given in the thread uses a specified cell address to execute the macro. Where as in my case I can not provide a specific cell address as any training can be canceled.
View Replies!
View Related
Run Macro Based On Cell Content
I have a drop down list made from the Forms toolbar with a list of items: 1, 2, 3, 4, 5. I have set it with a linked cell, so when you choose, say 3, from the dropdown, 3 appears in B10. I was hoping to add a 'Go' button, which would run another macro depending on what is in B10, i.e. so if 3 was chosen, then you press 'Go', Macro3 would be run. So I have 5 macros called Macro1 - Macro5, and I need some code for the 'Go' button which will run the right macro depending on what number is in cell B10.
View Replies!
View Related
Run Macro On Selection Of Validated Cell
I have a macro that I am running "onentry" of a worksheet. The problem is that I have some cells that are validated to allow a list. If I manually type a word from the list in the validated cell the macro runs. However, if I make a selection from the list the macro does not run. I guess vba does not see my selection as an entry.
View Replies!
View Related
Worksheet_Calucate, Run Macro, Cell Is Formula
I want to run a macro when a cell in reaches a certain value. I have tried the following code but neither work Private Sub Worksheet_Calculate() If Sheets("Report Form").Range("I11") > 80 Then Call JobIs80percent End Sub Private Sub Worksheet_Calucate(ByVal Target As Range) If Target.Address = Sheets("Report Form").Range("I11") And Target.Value > 80 Then Call JobIs80percent End If End Sub
View Replies!
View Related
Find Non Blank Cell And Run Macro
I am try to write a bit of code which will find the non blank cells in column H (Range H4:H24) and when it finds a non blank cell make column C in that row the active cell and then run a macro. Once the macro as been run i would like it to look for the next non blank cell.
View Replies!
View Related
Run A Macro Without Breaking Cell References
I have a macro that cleans up data on one sheet, text-to-columns, flip rows of data, etc. Another sheet references the cells AFTER the data has been cleaned up. However, I can't put the cell references in from Sheet1 to Sheet2 before I run the macro because it breaks the references. Just a simple example, Suppose cell A1 contains the formula: =Sheet2!B5. If I go to Sheet2 and run the macro to clean up the data, when I got back to Sheet1, cell A1 contains: =Sheet2!#REF! The idea is that this is a template, and the user can input aggregate data, run the macro to clean it up, and then go to the other sheet. I can easily create the macro to add copy/paste between the two sheets, but I'm looking for a cleaner way to do this.
View Replies!
View Related
Run Macro While In Cell Edit Mode ..
In an Excel worksheet all command buttons are disabled while a cell is in edit mode or while the cursor is active in the formula bar. Is there a way in VBA to save the cell's contents and execute a command button if clicked while a cell is in edit mode?
View Replies!
View Related
Run Macro While In Cell Edit Mode
I have Form Button in Excel Sheet which Calculates by reading other excel sheet. Now the problem is when user enters data in a Cell by double Clicking on it and after entering data if he directly clicks on a button then Macro that needs to be invoked is NOT executed. The only way is that he needs to press EnterKey OR Click on any other Cell and then click on the button.
View Replies!
View Related
Run A Macro Based On Value Input In A Cell
I am using data validation to restrict the number of Characters a user can input in a range of cells. The number of characters in this however can vary based on which selection they selected in a different cell. To put this as an example, if the user selects "hello" in cell a1, the data validation would allow 10 letters in the cell range c1:c20. If the person selects "goodbye" in cell a1, then the validation would only allow 7 characters in cell range c1:c20. I have been using the worksheet Change function, however it updates the validation regardless of what cell is changed.
View Replies!
View Related
Macro Will Not Run Find And Replace With The Contents Of A Cell
I want to have a macro that will look at a few cells say A1 & A2 and then use the contents of the cells say 1Q07 & 2Q07 respectively to do a find and replace find 1Q07 and replace it with 2Q07. I want it to use the contents of the cell and not just the text because the contents of the cell will change each time used. I tride to do it here but I dont have it yet. It doesnt seem to pass the value to the variable and the variable doesnt seem to do the find and replace. Private Sub Update_Click() Application. ScreenUpdating = False Dim quarter As String quarter = CStr(txtquarter.Text) txtquarter.Text = CStr(quarter) Sheets("Income Statement").Select Dim oneq As Single Dim twoq As Single Dim threeq As Single Dim fourq As Single Dim fiveq As Single oneq = ActiveSheet.Range("A2").Value twoq = oneq - 1 threeq = twoq - 1 fourq = oneq - 4 fiveq = oneq - 5
View Replies!
View Related
Leaving The Cell Blank But Allowing The Macro To Run
How can I have my macro run in its cell and still allow the cell to be blank? Say I have a number, 0.99, in the cell and I want to delete it and leave it blank. I can either push "Backspace" or the delete key and it still leaves zeros. If I push the space bar it stops the macro (which I do not want to happen) and leaves the cell blank because I added a space.
View Replies!
View Related
Run Macro Or Activate Hyperlink With Cell Entry
Is it posible that when data or text is entered into a cell and the enter key is pushed that this can either run a macro or activate a hyperlink to go to another worksheet for user to follow further instructions? OR instead of going to another worksheet a pop up message appears with instructions and then can be OK'd to remove message and proceed?
View Replies!
View Related
|