I cant seem to get to work together in the same macro but that work great seperated. I need them to be in the same macro. The first just simply copy's text from one workbook to another:
ActiveSheet. Range("a1").Copy _
That worked ok but I needed to change it to the "active cell" instead of cell "a1". So then this line of code was made:
Dim userInputCell As Range
On Error Resume Next
Set userInputCell = Application.InputBox("Use the mouse to select a cell on any sheet", type:=8)
On Error Goto 0
If userInputCell Is Nothing Then
MsgBox "Cancel pressed"
Msgbox "You selected " & userInputCell.Address(,,,True)
The second code works just the way I want it but it doesnt copy over the text to the other workbook. I assume the 2 codes need to be together but I cant get it to work without errors. I also need the text to copy over without changing the borders on either workbook.
I need the code to allow a user to select a column of their choice in an open workbook of their choice so that data can be lookuped up and changed. I am happy to create the code to do the lookup/changing, however the nearest I have found is the use of an inputbox which is limited to the active spreadsheet only. Some people have said the input box could be used over to another spreadsheet but I have not found that to work.
What I will need returned is the workbook name, sheet name and column. That will allow me to point to that and do the task.
This code could be used by 5 people and those 5 people could be running it on 20 different spreadsheets.
I thought this would be easy to find but it has eluded me. When using Excel normally, if you do a simple lookup formula, or create pivot function, excel prompts the user to select the workbook/sheet.
I have a protected worksheet with a mixture of locked and unlocked cells, and I'd like to provide an option to allow the user to select a large range of mixed (locked and unlocked) cells and, in the unlocked cells only, pre-populate with a standard formula.
I've got most of it working, but what I need is the specific code that allows the user to specify the range of cells they want the macro to act on.
I have made a sheet where the user can insert/delete rows in a certain intervall of rows. The upper row is 17, that is I have named the cell "First" and then the last row "Last" and then I am using integers:
Dim intStartrow As Integer Dim intLastrow As Integer intStartrow = ActiveSheet.Range("First").Row + 1 intLastrow = ActiveSheet.Range("Last").Row - 1
So it is only possible to add/delete rows if the markerer is in between the above rows.
Now I would like to select the rows, from first to last. Since the rows are never the same, users add and delete rows all the time, I can not use
Can I somehow make a range selection using the Integers, somethimg like
With ActiveSheet Selection."intStartrow:intLastrow" End With
In the attached file, I want to have the user select a receipt # and have it copy the information, for that receipt from the log, to the receipt tab. Then I want it to print the receipt. The macros that are in the file already, were created before I added a column for Receipt No., and don't ask for user input. File is attached.
I'm trying to get a users' selected range to display in a cell as stored text.
therefore, If a user selects A1:D7. The text in Cells("G", 10) will be:"A1:D7"
w/o the quotes.
I've attached an example workbook. Here's the formula thus far:
Sub SelectRangeBox() Dim rnBody As Range Dim vaMsg As Variant Do vaMsg = Application.InputBox( _ Prompt:="Please enter the message-text:", _ Title:="Message", _ Type:=2) Loop While vaMsg = ""................................
Actuall maybe my thread should be Titled. user selected cell range displayed in input box save to cell as a text value.
What I need to have happen is that the user decides what duplicate row to delete. The reason that there is a duplicate is that Row 1 has something different from Row 2. In my example above, CU1 is different from CU2. This is what caused this loan number from CR to be duplicated. I need to delete at my discretion one of the 2 rows.
What I would like is to have the user Select Range CR1:CR2 (this is relative in the sheet), run the macro, have it select the 2 row range, compare (relative) B1:B2 are they equal, compare C1:C2, are they equal, etc through the rest of the range. I would like the screen to update and stop with the range highlighted that is and and a MsgBox to click ok to Continue, then continue through the rest of the range. Once it has finished cheking the range, can the user use the mouse to select the range from CR that needs to be deleted, have the appropriate range selected and then the MsgBox Is this the range you want to delete? Y/N........................
I'm trying to create a macro for another user that she will use repeatedly for many different spreadsheets. Each spreadsheet will have a varying amount of rows that will need to be exported to a different file. She will highlight the cells she wants exported and then hit a button to do so. My problem is this: how do I code a macro so that it will know which cell is the beginning of her selection and which is the end?
I have a long header I am pasting to a column "A" on a new Sheet. When the header pastes it is repeating itself but with long blank spaces in between each repeat. The first time goes from A1 to A152, which is all I want. But it shows up again starting at A180225, and again at A212993, and again and again. I only want a single instance of the header in Column A. Here is the macro I am using:
Sub Sort_Cells() Rows("1:1").Select Selection.Copy Sheets.Add after:=Sheets(Sheets.Count) Sheets("Sheet1").Select Columns("A:A").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ True, Transpose:=True Selection.Columns.AutoFit Range("B1").Select End Sub
I have a workbook with several sheets. I have written a macro to check if the value in a column is matching with that in another column in another sheet and return the value in a preceding column in the second sheet into a preceeding column in the first sheet. The code looks likes this and seems to be working fine.
Sub Copy_Price_Code() Dim Rw As Long For Rw = 6 To Sheet6.UsedRange.Rows.Count
However, there would be more sheets in the workbook in future and I need to edit the macro in such a way that the user can select the source and destination sheets which I could use in the above macro. I tried to do it as follows but its not working.
Sub Copy_Price_Code() Dim Rw As Long Dim Rw2 As Long Dim Sourcesheet As String Dim Destinationsheet As String Sourcesheet = InputBox(Prompt:="Enter source sheet name. (example: Sheet1).", _
I am wanting to pause a macro to allow a user to select a cell and when the user hits enter the macro starts running again. My intention is that a user would select cell B5 or B8 or B55 and then hit enter and the cell would move 6 cells right and enter a value from the macro. The following is what I have tried and even though it allows to select a cell, it doesn't make that cell the active cell.
I was planning to do was have a macro where the document opened and the cell that information was pasted in was decided depending on which cell was selected when the macro was run.
This worked fine, but it does mean that it needs someone who can edit the VBscript every time there is a new starter or someone leaves so isn't really viable.
What I was wondering, is if it is possible for me to start a macro, which then drags in the information I need from a text file, does all the calculations and rearranging, and then brings up a prompt for the user to open the document they want to paste it in, click on the cell where the pasting will start, and then the macro continues from there?
To try to explain it in as clear a way as I can. Say we have three managers, Alan, Brenda and Charlie. In Alan's team there are 10 staff members. Aaron, Bill etc.etc. If we have just run the report for Aaron, the macro will run, automatically drag all the information in and rearrange it, then it will pause while the user opens up the "Alan" spreadsheet, they select the "Aaron" first cell, click OK or something, and then the macro continues on its happy way?
I have a base document that i can import another data document with a button (this is working).
I then have another WS ("search") in the base document with lots of identifiers which I want to use as my search range to look through the document that I just imported (column A).
I need a msg to ask the user what month they would like to find the $ value on (Ie, January) in the imported WS... this way it doesnt copy the entire line only cell in the selected month column.
Then I want to the user to be able to click a button that will check through the identifiers on the "search" WS and if the same identifier appears in the imported WS in column A, then for the $ value in the column selected to be copied to the search Range work sheet.
If the idenfifier is not matched then in place of the $ value copied can be the string "no in XXX WS" .
I have attached the document with dummy data in each work sheet with details more cleary what I have meantion above.
I have created the following code by recording a macro. The ActiveCells (“A1.A5203”) were based upon the actual number of records at that time. I wish for this macro to be used in a template and the actual number of records will vary from time to time. What do I need to add to this code to allow the AutoFill function to operate and fill only the actual number of records that exist.
i'm writing a refrigeration selection user interface, working from values on an excel spreadsheet. how to get the programme to automatically select a value from a list or range once a user has selected corresponding value from a list within a combobox. for example if a user sets the temperature of their refrigerator to -5 celsius i need the programme to automatically select the corresponding value of enthalpy for the air at that temperature.
If possible could someone please help with changing the below code so that column "D" in the rngIn part of the code can be a variable. i.e so the user can select one, two, three or four columns (with visible data) to be copied. The "b3" part is a constant.
I have a macro to search column E for an occurance of the text ALPHA,(there is more than one occurance of the text, so I'm using a loop to search for the next occurance,once the first one is found. No problems there).
Once I find a Row that contains ALPHA( say Row 15), I want to Copy the columns A15:R15 (NOT the EntireRow).
how I can Copy only a Range of Cells and not the EntireRow?
I am attempting to select a row if the date field value is within a date range.
I would like to be able to click a button, have a pop-up, be asked to insert a start date and an end date. For example 2014-07-01 and 2014-07-21 I would then like the macro to copy rows if the date value is within that range to the next available row onto a new worksheet.
First I will explain what this workbook does. In worksheet "sheet1" I use "change sheet" button to change the backgroud by selecting some pictures, in range S14 I have one number from the name of the background picture (using substiture function). By selecting one cell (with blue text) + one value from the combobox, in worksheet "sheet2" : -the selected value in column A will be deleted - the selected value in column B will be added - in column C I will see the adress of the active cell (cell with blue text) - in column D I will see the blue text from the active cell
I need in column E to copy the range S14 from "sheet1" when I select a value in the combobox ! The range S14 will have different values! I had tried this code (in module1 "Sub test") but it's not working how I need it to work:
I am trying out with a code which checks for cell value as "Select" in column IU and then checks for corresponding column IV for value as "0". Please note that "Select" and "0" are populated by formulas. I need the select "Select" and "0" till the next "Select" occurs in column IU and delete the selected range and continue the process until last non empty cell based on column C.
I have written the below code but it doesn't work.
Code: Public Sub Test() Dim nRow As Long Dim nStart As Long
I could have uploaded the excel file that I am working on but did not find any upload attachment option.
I have looked through the forum and found pits and peices but can not put the puzzle together. Found the VBA code in my example from a earlier post but there was no final answer to the post.
Trying to have the user put in a date range via command button. Fro mthis date range the data thats falls within that range is copied to a report sheet. Will also need to have all the old data from a earlier querry removed. Have attached example sheet.
I have a worksheet that contains about six different tabs. When this form is completed some users might want to have certain tabs copied into a different workbook. Unfortunately each user might want to copy different tabs. I was wondering if there was a Macro that I could write that would ask the users which tabs they want to copy into a new workbook.