Cut And Paste - In A Macro
Mar 18, 2008
If i wanted a cut a chunk of a data and paste it on another sheet how would i do this using a macro?
Considering the range can be different everytime.
I have this:
Rows("1948:2001").Select
Selection.Cut
Sheets("Non BW data").Select
Range("A1").Select
ActiveSheet.Paste
But can i use an if statement? using names of people, ie cut cells A1:B1 if = John?
View 9 Replies
ADVERTISEMENT
Jan 29, 2014
I would like to implement specific cell ranges from two specific worksheets each within 33 workbooks (which all have several tabs) into a summary page in a separate workbook.
The cell ranges are going across my spreadsheet in rows and I would like for them to transpose into a columns depending on the data which I have separated by catergory on the summary page. They are all on the same location in each workbook which is separated by country. The cell ranges are E26:P37 and I would like to transpose them and have them put below eachother without overwriting for my format on the summary page, how I can put this together in a macro?
View 1 Replies
View Related
Oct 1, 2012
I have one workbook that needs two macros.
On the "Complete Backlog" tab of my workbook, I want users to enter in the requested information based on the column header. Then I would like a Macro attached to a button that says "Refresh" that the user would click after they have entered in all of the information. This macro should look in Column M (WIP Status) and if any of the cells say "Close", it should Cut the entire row from the spreadsheet(Ex. A2:M2) and Paste it into the speadsheet titled "Closed Jobs".
This is so that as jobs are closed/finished, they are removed and stored on a separate sheet. The items would have to be pasted so that it pastes into the next available row - not just on top of each other.
I also need another macro that i can put into a button that doesn't "delete" a row from the sheet, but just copies over to another sheet - so that there are two instances in the workbook.
If would look something like: If a cell in "Column G / Director" of the "Complete Backlog" speadsheet is equal to "Snodgress" then copy columns A-L of the same row to the spreadsheet titled "Snodgress" - of course skipping down the rows to the next blank row.
.....is equal to "Herr" copy row to "Herr" spreadsheet.
....is equal to "McCormick" copy row to "McCormick" spreadsheet.
and so on.
View 2 Replies
View Related
Oct 26, 2007
I have a macro that does lots of cutting and pasting, and to make sure it can run without interference from my normal work, I did add the line Application.Interactive = False. But seems while I am cutting and pasting in other windows while the macro runs, sometimes it crashes on the paste part. Is the macro and the Windows Operating system sharing the clipboard?
FYI, Windows XP professional, Excel2000.
View 9 Replies
View Related
Jul 10, 2006
I want this macro to find in this case "406" in column A which is at the very end of the last block of 160 rows of information.
I then want it to move up 159 rows and copy 160 rows of information underneath the last block of information.
i.e.go to A5280 , then go to a5121, copy rows 5121:5280 to 5281.
It falls over on the very last line of code I can see A5281 selected but it won't paste....
View 9 Replies
View Related
Jul 21, 2007
I am making a spreadsheet that sorts and pastes, but I need to know if I can add a code to the Sort and Paste Macro that will open the second spread sheet needed without just already having it open and using the
Windows("estimate sheet one.xls").Activate
View 2 Replies
View Related
Sep 17, 2009
I need a macro to get the values from cells D29 and H24 in the Resource Calculator sheet and populate it into cells N8 and O8 in the Input form.
Users will then be able to change the information in the calculator and click the macro again to populate N9 and O9 and so on.
Is there a way to do this?
I've attached the file for you to see.
View 13 Replies
View Related
Jun 30, 2006
I need a a macro I can run about 5000 times to move data around in a spreadsheet. The ones I tried to create loop and screw everything up.
I want to:
click on a cell of data in Column A
Cut/copy
F5
input the new cell destination
paste in the new cell
go back to column A one row down
View 4 Replies
View Related
Feb 6, 2014
I am trying to write a macro for CUT & PASTE from one column to another.
The data is always in cell 'I', and should be transfered to cell 'F' (CUT & PASTE).
However, not all the cells in column 'I' are populated, therefore it is required to skip the empty cells.
View 1 Replies
View Related
Jul 13, 2007
I tried writing a macro to copy data from one tab and paste it on another. It gave me an error message every time.
So I tried recording one doing just that, and when I went to play it, it still gave me an error.
So here is what I came up with:
View 10 Replies
View Related
Aug 9, 2007
I am trying to do a paste special of this code from Paul into a specific cell so that when the conditions are met the cell will update automatically. The code works great, I just have to manually run it.
I have tried to copy all of it as it stands here then use the paste special, paste only values; but it pastes the text in the cell and adjacent cells. I have done this before successfully with simple formulas, not actual code. The cell is clean where I want to paste this also, no strange formatting or anything like that.
I have this great code but can not use it….
Sub test()
If Range("B13") <= Date Then
Range("E13").Copy
Range("F13").PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
End If
End Sub
View 14 Replies
View Related
Sep 14, 2008
I have some simple Macro code that works fine for the COPY side of the action...
View 14 Replies
View Related
Nov 14, 2008
I have a macro that copies the main report sheet in my workbook. The point of the macro is to get a copy of the report data without allowing anyone to see the formulas/data behind it - when it pastes, it pastes only the values in the tables and then copies the charts, deletes the live ones, and pastes only the images back on the sheet. The macro works on my computer and my partner's computer, but not on anyone else's. It stops at this point:
View 5 Replies
View Related
Nov 26, 2008
Sorry to be leeching again. Those who can code, those who can't, ask.
I have a spreadsheet with daily temperature readings. The first row contains the headings: Day, Jan, Feb, ....., Year. The "Day" column goes from 1 to 31 and continues again. Hope you get the picture.
My problem: I imported these data from a text file but Excel couldn't align the data properly. Hence I need a macro to realign some of the data onto the correct cells. Here's a simple alogrithm I've worked out:
I need to move cells from i) (C31:L31 to D31:M31); ii) H32 to M32; iii) G32 to K32; iv) F32 to I32; v) E32 to H32; vi) D32 to F32; vii) C32 to D32 for every 31 cells, i.e. the next to be moved are C62:L62 to D62:M62 and so on.
By right, this is simple enough for me to write a code but the snag comes because for non-leap years, I need to add a code which move cells C30:L30 to D30:M30.
I don't think a code that shift cells every 31 rows would help due to the leap years. Hence by my extremely limited knowledge of programming I think the only way is to tell Excel to recognize the kind of year it is, i.e. leap year or non-leap year (years are in column N) before executing the commands.
View 14 Replies
View Related
Jan 19, 2009
I work with large charts with many users updating them. With people not following directions metrics are getting messed up. I'm trying to come up with a macro that when someone tries to paste from a different version, or something they copied earlier, the workbook/worksheet will not allow it, so that they have to type in the required information to avoid errors. I'm now working in Excel 2007. It would be nice just to have this option within the program without having to lock down the workbook.
View 4 Replies
View Related
Feb 18, 2009
I have a total of 30 sheets in my workbook. I would like to copy rows 21:1000 from sheets 5 - 27 and paste them into sheet 4 starting on row 21. The data ranges vary within sheets 5 - 27. For example, sheet 6 has data in rows 21:50, whereas sheet 10 has data in rows 21:500. I chose 21:1000 as a safe measure to ensure that all data starting on rows 21 onward gets copied.
I am having trouble thinking of how to create a macro which will copy the data from sheets 5 - 27 and paste into sheet 4 leaving no blank spaces in between pasted rows. Ultimately my goal is to use the filter boxes I have set up in the column headers of sheet 4 to quickly sort all the data pasted from sheets 5 - 27.
View 4 Replies
View Related
Mar 6, 2009
im trying to record a macro that allows me to copy b22-b25 so i can copy it sp its on my clipboard to use in other applications
but i have this and it doesnt allow me to paste
View 14 Replies
View Related
May 1, 2009
I need a macro that will copy row 7, then let user select desired row, then the macro will paste the copied row onto it.
View 5 Replies
View Related
Sep 16, 2009
I've got a sheet which has two column headings - Resources and Cost. I have another sheet which has the calculations for both of these. They are in cells H24 and D29 of the second sheet. I want to have a macro on the second sheet that if I click it, it will paste special these two figures (values only so no formulae), into the active cell on the first sheet. This is the code I've got so far but every time I run the macro it just pastes into the same two cells in the first sheet.
View 4 Replies
View Related
Nov 6, 2009
I have a number of workbooks which contain 62 tabs each. I need a macro that copies specific information from each tab and pastes it to a summary table which will be uplaoded to an access database. I created a macro that works when I manually click on each tab and run the macro. I then added a loop to try and automate. when I run the macro, it loops through all of the tabs, but it only copies and pastes from the first tab, resulting in 62 line items fron the 1st tab. I need to know how to set the active tab to which ever tab the loop is on.
View 5 Replies
View Related
Apr 3, 2012
I'm in need of a macro that can look for a specific text in a column, cut the entire row and paste it in a new worksheet.
Row 0Column AColumn BColumn C
Row 1XXXX Blue XXXX
Row 2XXXX Green XXXX
Row 3XXXX Red XXXX
Row 4XXXX Green XXXX
Based on the above example I would need a code that look for "Green" in Colum B and Cut and paste that to a new sheet called "Green". I also need to add something that will copy the first row (Row 0 or header) to the new sheet. So far I'm able to find green and copy it but I can find a way to delete from the original worksheet.
View 1 Replies
View Related
Nov 9, 2013
I am venturing off on to my 2nd Macro Formula. This one is a little different than my first and I am not sure where to start, to correct the piece I am missing. I am able to create the basics, I have added the "Last Row" formulas. The piece I am missing, when I control end & "paste", it is pasting on the last row with content. I need it to paste to the row BELOW the populated content. Here is my current smaller sample of what it is doing.
Sub Macro2()
'
' Macro2 Macro
[Code].....
View 2 Replies
View Related
Mar 14, 2014
The macro below will copy another tab and rename it based on the formula results in a a range, and this works perfectly. However, I also want it to take that value that was used to rename the sheet and paste(value) into the corresponding sheet in the range B8:M8. The code that I have so far is below, but I'm not sure how to tackle this second part.
Code:
Sub CopyTemplate()
'
' CopyTemplate Macro
'
Dim rcell As Range
Dim Sheet1 As Worksheet
Set sheet1 = ActiveSheet
[Code]...
View 1 Replies
View Related
May 8, 2007
I have been using the following code but need help in editing it.
Sub PasteValues()
Dim cl As Range
ColRef = InputBox("Insert Column Range - Paste Formulas to Values")
For Each cl In Range(ColRef & "1:" & ColRef & Range(ColRef & "5000").End(xlUp).Row)
cl = cl.Value
Next cl
End Sub
I want it to do the same thing by pasting values throughout a column, but I need it to skip cells if column A is empty.
I have attempted to edit the code by implementing previous code written for the opposite situation where a formula is pasted only if data exists in A, but was unable to get it to work. Here is that code.
Sub CentralDivision()
Dim ws As Worksheet
Dim strCol As String
Dim Cell As Range, Rng As Range
Application.ScreenUpdating = False
Set ws = Worksheets("CENTRAL DIVISION-2007")
strCol = InputBox("Entrer the column you want the formula in please.", "ENTER THE COLUMN", "Your Column Here")................
View 9 Replies
View Related
Dec 3, 2007
i'm currently building a project with VBS2008, i'm currently stuck on 2 things.
I have the beginning of my code here(it's a button):
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
Shell("C:Program FilesMicrosoft OfficeOFFICE11EXCEL.EXE")
AppActivate("Adobe Reader")
'copy stuff wants to go here
'Then i want to paste into Excel
AppActivate("Microsoft Excel")
'Then run a macro
(PERSONAL.XLS!Eden)
End Sub
Adobe Reader will always be running.
I'm trying to copy all text data from Adobe and paste it into Excel. I'm having trouble trying to mimic pressing [Ctrl-A] [Ctrl-C] and then mimic the paste [CTRL-V] into excel, then running the Macro in Excel.
View 9 Replies
View Related
Dec 14, 2007
I'm trying to get my macro to paste the header row along with the data it's pulling. The code works without the ActiveSheet.Paste portion, but i want to be able to add that in somewhere. Here's the
Sub DataCreate()
Dim lstrw As Long, x As Long, y As Long, c As Range, fnd As String
Dim nxtrw As Long, dest As Worksheet, ws As Integer, caddress As String
Dim destwb As Workbook, srcwb As Workbook, src As Worksheet, src2 As Worksheet
Set srcwb = ActiveWorkbook
Set src = srcwb.Sheets("CUSTOMER ID")
'Change sheet name ot fit the sheet that has your list of unique ids
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
lstrw = src.Cells(Rows.Count, "a").End(xlUp).Row
For x = lstrw To 2 Step -1
fnd = src.Cells(x, 1)
Workbooks.Add.SaveAs fnd & ".xls"
Set destwb = Workbooks(fnd & ".xls")
Set dest = destwb.Sheets("sheet1")
For ws = 1 To 1
Set src2 = srcwb.Sheets(ws)
If WorksheetFunction.CountIf(src2.Range("b:b"), fnd) Then
With src2
With .Range("b:b")
Set c = .Find(what:=fnd, after:=.Cells(1, 1),
View 9 Replies
View Related
Apr 13, 2008
I have a requirment to be able to copy a data range from one sheet to another. However each time the macro is run I need to be able to change the ROW the data is pasted to via user input.
EG First time macro is run, range to be copied from sheet 1 is A1:D1 and then pasted to sheet 2 range A5:d5.
the second time the macro is run I need to tell it to paste the data from Sheet 1 A1:D1 to Sheet 2 range A6:D6.
I guess the ultimate way to achieve my need would be for excel to find the last row of data on sheet 2 and automatically paste to the next free row, but thats way beyond me.
View 9 Replies
View Related
May 27, 2009
i am trying to record a macro that copies and pastes data from a webpage into a sheet in excel and then copies and pastes different data from a different webpage into another sheet in excel.
when i replay the macro it just pastes the same data twice instead of 2 different sets.
i am obviously making a basic error - is the way i copy and paste?
View 9 Replies
View Related
Nov 2, 2009
I have an index page with all my employee numbers and a summary page.
All my employees work on a time payment basis.
So for every Employee there is a worksheet with a calculator that determines their working hours.
I need a macro that copies the information on every worksheet to the summary worksheet.
On the worksheets the information is in calls: A53:F53
The Macro needs to paste that information under each other. So for instance employee 255 has a worksheet with the label of 255. His information needs to be pasted in the summary in cells A2:F2.
The next employee is 503, he also has a worksheet with the label of 503. his information is in cells A53:F53 (the same for all the employees). This needs to be pasted to the summary page in Cells A3:F3 (underneath employee 255)
I have 802 worksheets and 1 Summary. All the information for all the employees is in A53:F53.
I tried to do a record macro, it worked but excel gives me an error that sad : Procedure to long.
this is the code that i used:
Sheets("002").Select
Range("A53:F53").Select
Selection.Copy
Sheets("Summery").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Every employee has a coding like this..... so you can understand that excel thinks the procedure is to long.... ha ha ha..
I need the macro to paste only values and not the formula.
View 9 Replies
View Related
Apr 22, 2006
I have an excel form that I fill out when I service a vehicle. This form has a couple of cells that I would like to transfer to different workbooks by way of a macro.
The form cells that I want to transfer are labeled as follows:
InvoiceNumber or cell Q3
Date or Cell R5
TotalLabor or cell R31
TotalParts or cell G31
Tax or cell R40
I have 3 external files named:
Tax - this file has 4 columns: Date, InvoiceNumber, Tax
Parts - this file has 4 columns: Date, InvoiceNumber, TotalParts
Labor - this file has 4 columns: Date, InvoiceNumber, TotalLabor
I would like to have each external file copy the info into the next row and keep a running total at the bottom.
View 4 Replies
View Related