Running Userform From More Than One Sheet And Return To Original Sheet

Dec 12, 2012

I've got a User Form that works perfectly. It's activated on Chart Month sheet, you enter data into it and it switches to Comments sheet and copies the data, before returning back to the Chart Month sheet.

I have now added the same functionality to Chart Week sheet. Both Chart sheets use the same comments data, so it doesn't matter if you run the User Form from Chart Month or Chart Week. However, when I run the User Form from Chart Week then it switches to the Chart Month sheet once it copies the data, as I have Chart Month in the code. How do I get it to return to the sheet that it was originally on ie either Chart Week or Chart Month?

Code:
Private Sub CommandButton1_Click()
Dim emptyRow As Long

'Make Sheet30 Active
Sheets("Comments").Activate

'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("D:D")) + 1

[Code] .........

View 4 Replies


ADVERTISEMENT

Vb Return To Original Sheet To Paste

May 1, 2008

If I ask in a macro to open sheet containing a fax header, copy it, then how do I tell Vb to return to the original sheet to paste. There many sheets that require this from a button click on the sheet and instead of storing the graphic in all sheets I just want 1 copy so file closes faster. I would normally just name the original sheet, but this will change with every sheet.

View 13 Replies View Related

How To Return To Original Sheet The Name Varies

Oct 2, 2008

I need to know how to select the sheet the user was on at the time they ran the macro. The macro has to select (because I'm not yet smart enough to avoid all the selecting...) cells on other sheets, but I want to return to the sheet they started from at the end of the macro.

Unfortunately, they create these sheets themselves, and I have no idea what they will be named, or where they will be, or what their code numbers will be. They could delete them at any time and rearrange.

Sorry if this is a really dumb question. I suspect it is, but I can't find out how to fix it, and most people are smart enough to avoid the selects so I suspect it isn't an issue for them.

View 9 Replies View Related

Return To Original Sheet After Print Array

Jun 14, 2006

The code prints a series of sheets. Afterwards these sheets are "group"ed together. The code can be accessed from 2 different sheets. I need to figure out how to get rid of the grouping and return to the original sheet.

Private Sub CommandButton1_Click()
Sheets( Array("Pipe", "Pipe Flow")).PrintOut
UserForm1.Hide
End Sub

View 2 Replies View Related

Running Total In TextBox On UserForm From Sheet

Jun 21, 2006

I am trying to get running totals in three TextBoxes on a UserForm. The UserForm is to enter one item from a receipt which can have many items. The running total is for the number of items on the receipt, amount of discounts (coupons), amount of sales tax and the grand total. A small sample is attached

View 4 Replies View Related

Looking Up Value In Second Sheet And Returning Multiple Values To Original Sheet

Mar 11, 2013

Possible to look up a value from one excel sheet in another sheet and then return multiple values in the first sheet

For example the following is a sample of sheet 1

NSV Code
Item

12
OLANZAPINE

54
ROPINIROLE

And the following a sample of sheet 2 :

Nsvcode
Item
Division
Speciality
Qty

12
OLANZAPINE
CLINICAL
CS
10

[Code] .....

I want to lookUp the NSVCode from sheet 1 in sheet 2 and return the speciality and qty values in sheet 1 as sheet 2 contains a lot of info I do not require and sheet one also contains various pricing calculations I also require.

View 7 Replies View Related

How To Return To "original" Sheet After Using A Link To A Other Sheets?

Jun 17, 2008

I have a workbook with about 200 sheets.
Each sheet contains lots of links to the other sheets, so the user can clink the link and then go to the new sheet.

But, how do I make a "return-function"? That can return the user to the sheet that was active before the link was followed? If possible I would like this do be doable for 5-10 sheets back.

This "return-function" is gonna be used by clicking a button on a floating toolbar I have connected to the sheet.

View 9 Replies View Related

Double Click Row To Return Data To Userform For Edit Then Return Back To Sheet

Jan 30, 2014

I am trying to create a data entry sheet to enter quotes on. When a quote is received, I click on my "Add quote" button and a userform appears. Data is entered into the userform (frmEntryForm) and returned back to the next available row.

I also need to be able to:

Edit a row by double-clicking it. When a row is double-clicked, data from that row is passed back to the userform, edited and returned back to the same row (to prevent duplicates).Validate that all fields are complete within the userform where relevant (i.e. if the work is not complete or in progress then the "Invoice Number" and "Actual Cost" fields are disabled and blanked to prevent entry (I think this is almost sorted judging by my tests)

I have attached my sheet : 2014 Gatwick Quote Log (Macro Enabled).xlsm‎

View 14 Replies View Related

Running Multiple In VBA Instances: Controlling Spread Sheet Always Waits For The Code To Return Before It Continues

Apr 28, 2009

i have a spread sheet which has a very complex simulaton in it. excel is not the ideal place for it, but it is not possible to port it wholesale to something more sensible. i have modified the code so that it is possible to run two copies of the spread sheet (in two seperate excel processes) at one time. Due to the dual core nature of the machine this has almost no overhead.

I have created a controlling spread sheet that is cabable of launching multiple copies of the simulation and starting the code executing. the problem is the controlling spread sheet always waits for the code to return before it continues, hence it would open two seperate versions of excel, start the first simulation executing and then wait until it completes before starting the next one. is there any way of starting a function in another work book without waiting for the execution to complete?

View 2 Replies View Related

Return Focus To Sheet While Still Displaying A UserForm

Dec 16, 2009

I have a spread sheet where i want to display help text when cells are activated. I do not want to use comments as i both do not like the red triangle and also have not found a way to controll the position of the text box. When I use the event Worksheet_SelectionChange I can display a custom box but the box "retains focus" and i can not enter the data until i "reclick" on the cell in the sheet. The box then goes away when i select another cell. Is there a way to fix this or a different method entirely. I am using Excel 2007.

View 9 Replies View Related

Creating New Sheet From Template Sheet & Filling In Summary Sheet - Userform

Oct 22, 2007

I have some experience with excel, but until now have not ventured into VBA and macros.

I have a workbook which will have the following sheets:

1.Absence Summary sheet - Summarises data from each employee's individual sheet.

2. Template Sheet - A sheet formatted as an absence record sheet, but without data.

3. Individual employee Absence record sheets - Based on the Template sheet.

I have read with interest the various posts and help files on User Forms & Macros, but have got a bit stuck.

My Aim: ....

View 11 Replies View Related

Cut And Paste (row On The Original Sheet Shrinked)

Sep 18, 2009

When i cut a row and paste it to another sheet, that row on the original sheet is shrinked. I don't know if my vba code has something to do with that
so just in case will put it here:

View 2 Replies View Related

How To Copy Sheet And Place After Original

Oct 15, 2012

I need to copy the sheet being worked on, and place it behind the original sheet.

This is going to be in a Macro enabled template that other users will be rename when they save it.

It will be activated by a button on the original worksheet other users may need to rename the worksheet before copying so I am using ActiveSheet.Copy I don't want to put the sheet after a counted sheet, because other sheets may be inserted before the one being worked on. I am not proficient at VB, I basically search for a macro that does what I need and copy it.

This is what I am working on.

Sub CopySSR()
'
' CopySSR Macro
'
'
ActiveSheet.Copy After:=Sheets(7)
End Sub

View 2 Replies View Related

Copy Sheet To Same Workbook Without Overwriting Original

Aug 11, 2007

I have some code written to duplicate a template and rename the copy to "Working Copy".

But if I run the code more than once, it breaks as VBA tries to overwrite the sheet with the same name.

Would I would like is for the macro to check to see it already exists and duplicate the copy with some type of incremental integer. Thus the first duplicate would be Working Copy 1, and if the macro is run again, the duplicated copy would be Working Copy 2, etc.

here is what I have so far:

Sub SCButton()
Dim i As Integer 'for making Working Copy 1, 2, etc.

Sheets("SCTemplate").Select 'this file will eventually be hidden and thus the user with only see the wokring copies.
Sheets("SCTemplate").Copy After:=Sheets(4)
Sheets("SCTemplate (2)").Select
'some sort of If statement here to check for the sheets

Sheets("SCTemplate (2)").Name = "Calculation"

View 5 Replies View Related

Extraction Sample Of Emails From A Sheet Proportionate To The Original

Nov 10, 2009

I have been set a task to do and I wonder if you could point me in the right direction.

Task - extract 2000 emails from a 6000 email database

The 2000 emails have to be proportionate to the original database.

e.g.

The main database has the emails plus town and employee size ranges

Column A - Emails Column B - Town Column C - Employees

So if Column B states that 50% of the entire database is from one town, then my extracted emails must also have half from that town (1000).

Also there are around 5 employee ranges and so they need to also be proportionate to those percentages too in the final extraction.

View 10 Replies View Related

Macro To Save Sheet With Same Page Breaks As Original

May 14, 2009

I am trying to sort a macro out to save my sheet the same as the original when the button is clicked. When i try it from one location it is fine but from another location i get a print error, the error says prit quality is not right, when i debug it highlights: Print Quality = 600 I have tried changing it but keep getting the same error. Their maybe an easier way to do this but not being very good on VB i dont know what to do. This file is on a server and will be accessed from different locations.

View 2 Replies View Related

Create Copy Of Active Sheet & Convert Original To Values Only

Feb 11, 2009

I need to copy the Selected Sheet (Sheet name will be different each month) on a spreadsheet and paste the copy to the left of the selected Sheet. Then I need to copy and paste values the entire sheet of the sheet that the copy was made from (the one on the right). I am very new to macros, and I tried recording and manually editing the macro with no success. The number of sheets will be different always as I will be adding this to different workbooks and also because new sheets may be added to any workbook at any time. I attached my code that I came up with, as I am not familiar with code enought to "[code]" my code.

View 3 Replies View Related

Loop Through Sheet And Match Entries On Userform To Non-empty Cells In Sheet

Oct 27, 2012

In the attached worksheet I have UserForm2. When I click on open compare form button on the menu sheet it opens UserForm2, I would like the information I select in the first 7 combo boxes Vegetable - Ball on UserForm2 to loop through the data in the database sheet Columns A:G and compare the entries to the non empty/not blank cells in each row. If the form contain data that matches all the non empty/not blank cells in a row in the database sheet then it is a match and should show the label and display the message. If the form entries does not match to the non-empty/not blank cells in any of the rows on the database sheet then do nothing.

The problem I am having is getting it to loop through the sheet and bring back the right results. It is only matching on row 2 of the database sheet when I select cabbage in the vegetable combo box and apples in the fruit combo box . I cannot figure out how to get it to loop through all the rows for the range I want to compare (A2:G7) - I need this range to be flexible so as data is added it will expand to read all added rows.

The code is on the btnSave_Click() for UserForm2

I attached the spreadsheet and I am explaining what I want to do and the expected result.

Fruit
Fruit Type
Vegetable
Games
Toys
Cereal
Ball

[Code] .....

What I want to do is loop through the Database sheet and if the fields on the form contain all the values in any row of the Database sheet, excluding empty cells in the Database sheet, then display a message.

So if on the form I selected Broccoli fron the vegetable combo box, Cricket from the games combo box, puzzles from the toy combo box, bananna from the fruit combo box, grits from the cereal combobox, and baseball from the ball combo box, in the databse sheet tabel shown above the match would be row 6 since the values for vegetable, game, toy, fruit, cereal and ball on the form matches what is on row 6 of the Database sheet. It does not matter what other fieds are selected /filled in on the form, the match should only take into consideration the populated cell in each row of the database sheet.

So, if the user enters Apples in the fruit combo box and Cabbage in the vegetable combo box but had blank or something other than bike in the toy combo box on form it would be a match to the Database sheet row 2, regardless of what the user enters in the remaining fields on the form

If the user enters Berries in the fruit combo box, Blueberry in the Fruit Type Combo box, Carrot in the vegetable combo box, and Grits in the cereal combo box it would be a match to Database sheet row 3, regardless of what the user enters in the remaining field on the form .

If the user enters Apples in the fruit combo box, Cabbage in the vegetable combo box, and Bike in the toy combo box on form itwould be a match to the Database sheet row 5, regardless of what the user enters in the remaining field on the form .

If the user enters Grape in the fruit combo box, Carrot in the Vegetable combo box, Cards in the game combo box, and football in the ball combo box on the form it would be a match to Database sheet row 7, regardless of what the user enters in the remaining field on the form.

If the user enters Kiwi in the fruit combo box, Cabbage in the vegetable combo box, and Bike in the toy combo box on form it would NOT be a match to the Database sheet because the Database sheet does not have a row that contain Kiwi, Cabbage, and Bike.

So basically, if the entries on the form match the exact values for all the non-empty (blank) fields for any row in the Database sheet, then it is a match.

-If the entries on the form do not contain an exact match to all the non-empty (blank) fields for any of the rows in the Database sheet, then it is not a match.
-If it is a match show the label and display the message box
-If it is not a match the do nothing

View 2 Replies View Related

Excel 2010 :: Match 1 Cell And Column In Sheet 1 To 2 Columns In Sheet 2 Return Data From A 3rd

Jul 23, 2012

I have 2 workbooks in Excel 2010, each contain just 1 sheet. (see attached) I need to compare on sheet 1, cell D1 and column A:A (this column will be much longer), with the data in columns C:C & A:A on sheet 2, if a corresponding match is found, the data contained in column D on the same row on sheet 2 is written to the cell with the matching data in sheet 1.

My attempt is in cell D2 on sheet1.

View 5 Replies View Related

Userform Won't Load Info From Database Sheet To Invoice Sheet

Feb 16, 2008

I have a list box that I'm using to pull customer information from my "Customer" sheet to my "Invoice" sheet. I can actually open, select, and close the userform. However, I can't get the macro to put the information into the specified location on my "Invoice" sheet.

Here's my code so far:

Private Sub Cancel_Click()
Application.ScreenUpdating = False

Unload Me

End Sub

Private Sub customer_Change()

End Sub

Here is the "Customer" sheet I'm pulling the info from:

And here is the location on the "Invoice" sheet that I'm trying to direct the userform to:

And here's my userform just for reference:

The userform works perfectly until I press the OK button. That's when I get the error.

View 9 Replies View Related

Using A Userform Search A Spread Sheet And Show Cells In Another Sheet

Jun 28, 2006

I have included the table. What I want to do is in a user form pick a county ie Devon, Then by clicking "go" all entries that contain "Devon" are then copied to a " sheet 2" I don't want to use the Ctrl-F

View 2 Replies View Related

Search One Sheet For Updated Information And Return That Data To Another Sheet

May 4, 2013

Create a macro button in 'Spreadsheet 2' that searches 'Spreadsheet 1' for updated information specific to a certain criteria and adds it to a new row in 'Spreadsheet 2.'

There are three sheets

Prospects (where all original data is entered)

Actions -Bob (Bob's new Prospects are added to this sheet)

Actions -Frank (Frank's new Prospects are added to this sheet)

So in this example Row 6 in Prospects (Constituents, Rating, Manager and Solicitor would be added to ACTION - Bob's sheet on Row 5
and
Row 8 in Prospects (Constituents, its Rating, Manager and Solicitor would be added to ACTIONS - Frank sheet on Row 5

Here is the example spreadsheet - Prospects and Actions.xlsx

View 3 Replies View Related

Reference Sheet (return The Value Of Cell B2 On Whichever Sheet The Text Of A1 Says)

Nov 1, 2009

If I have a cell that has as its contents as sheet name, is there anyway I can use the cell's address to reference that sheet?

As an example, say I have in Sheet1, cell A1, the text Sheet2. And let's say I want to return the value of cell B2 on whichever sheet the text of A1 says. So, on Sheet1, I might have this:

View 2 Replies View Related

Lookup Single Value In One Sheet, Return Multiple Results From The Other Sheet

Apr 6, 2008

i have two sheets, one to display results (Reults tab) & the other tab containing the data (Data tab)

what i am trying to do is some how create a search function and have a forumula which contains a LIKE function that looks up the data table
RANGE = Data!A2:K255

the search needs to lookup the primary column Data!B2:B255 ... if any results are found .. show them on the results tab.. and if multiple results are found, display those as well.. (in either instance, the whole row of information in respect to the results need to be dislayed and hopefully no duplicates are found .. eg, Data!A:K of a hit)

is there a formula that can achieve this? oh, the search is TEXT based and there should be no empty cells within the dataset

after some MASSIVE googling, i have stumbled accross this

B1 = Search box (txt field)


A6 (which will be a hidden column) contains =MATCH($B$1,Data!A2:A255,0). this formula provides the first instance of the result and provides the row number


A7 contains =MATCH($B$1,OFFSET(Data!$A$1,A6+1,0,8-(A6+1),1),0)+A6.
this is supposed to look for the next row number which contains a match and provide that row number

and througout my other columns, i have
B6=OFFSET(Data!$A$1,A6,1)
B7=OFFSET(Data!$A$1,A6,2)
B8=OFFSET(Data!$A$1,A6,3)
and so on


2 things i cannot recitify..


1, the match has to be EXACT ... unfortunately i cannot use exact .. needs to be LIKE .. eg, i cant use the search word "boat" as the range of data has "boats"
2, it comes up with multile .. irrelevent results.

View 10 Replies View Related

Return Plank Not A 0 On 2nd Sheet When Nothing Is Type On Fist Sheet

May 8, 2014

I have 2 sheets in a work book both contain the customers address if I leave a line not type on on sheet 1 then it will put a 0 on sheet 2 is there a formula to stop this happening.

View 3 Replies View Related

Match Two Column Values From First Sheet And Return Value From Second Sheet

Apr 8, 2008

I have to match table column name with the column name in the sheets and get the values from column 6 in sheet2 if "# of values" in sheet1 matches with "Counter" of sheets for the same column.

if ("Table Column Name sheet1"="Column Name sheet2" then
if("Counter sheet2"="# of Values sheet1" then
return "Total # of rows Sheet2" from same row.
I am using Excel 2003.

Sheet 1 ....

View 10 Replies View Related

Search To Find Matching Cells And Copy/transpose Adjacent Data To Original Sheet?

Nov 12, 2009

I'm trying to find a way to search a second sheet in a workbook for specific criteria outlined in a first sheet (in my attached example, from A3 downwards within the 'list of search criteria' sheet), and then to copy any secondary data found against a successful search match to the original sheet, transposed against its corresponding matched search term.

As you can see in the example, the search term 'bindi' (A4 in the 'list of search criteria' sheet) appears in the 'data' sheet 3 times - the secondary data for these occurences ('feathery', 'Fibonacci', 'glassy') is copied to the 'bindi' row on the first sheet and is offset with each copy to produce a transposed-esque effect of copy and paste.

If it's any help, there are a maximum of 9 matches for a single search term in the real document.

Thanks in advance for your help... I tried to adapt a previous solution given to me for a similar question but failed miserably. I bow humbly to your expertise!

View 9 Replies View Related

Have Userform Populate Only Active Sheet Not By Sheet Name

Dec 4, 2012

I have a userform in my workbook with a button to access it on twenty different sheets in the workbook. Currently the userform will only populate the sheet titled "Blank1". How can I change it so it will populate the active sheet without naming it? So no matter what sheet I'm on when I hit the submit button the userform will populate only the sheet I selected the button on? See macro below.

Code:
Private Sub OKButton_Click()
Dim NextRow As Long
Sheets("Blank1").Activate

' Unprotect Sheet
ActiveSheet.Unprotect

[Code] ..........

View 2 Replies View Related

Return Sheet Name For Sheet Containing Text In Cell

Jan 5, 2013

I have a workbook that uses the following for a list of names (in a specific cell) over multiple sheets:

Burns, Charles; Simpson, Bart; Smithers, Waylon; Wiggum, Ralph

Some names appear on different sheets. I would like to create a TOC sheet that lists what sheet each name shows up on. I can pull the names and have a list of all of them, but how to

a.) determine all of the sheets where each name shows up and, subsequently,
b.) how to programmatically create a hyperlink to whatever sheet(s) each name shows up on.

I've attached a dummy workbook. The column in question is Content Owners. There would be a link to each separate sheet in different cells adjacent to the name.

CRSample.xls

View 8 Replies View Related

Formula To Add Two Cells In Sheet 1 And 2 And Return A Value In Sheet 3

Apr 4, 2013

I need a formula to add two (2) cells (one cell in sheet 1 and the second cell in sheet 2) and return a value of the two (2) cells in sheet 3. I would like the formula to return a zero (0) value instead of #VALUE! ERROR displayed in sheet 3 if a cell in sheet 1 has zero (0) value and the second cell in sheet 2 is blank. For example: sheet 1 D2 (0) + sheet 2 D2 (blank cell) = zero (0) instead of #VALUE! ERROR

In addition, if cells B11:B12 are blank in both sheet 1 and 2, I would like the formula to display blank in sheet 3 for cell C11:C15 instead of displaying #VALUE! ERROR.

Here is the formula I have: =IF(OR(ISBLANK(Sheet1!D2),ISBLANK(Sheet2!D2)),"",Sheet1!D2+Sheet2!D2)

Note: I have attached a sample data set for better conceptualization of the problem. Sample_Formula.xls

View 2 Replies View Related







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