I need a code that will copy the format AND formulas of the entire row that I have selected (or activatedwith my cursor) to each and every blank row - until it gets to the last row of data on this spreadsheet.Since any employee could have more than 1 row of data - I am using a code that inserts1 blank row after each NEW employee name.
NOTE: This report is initially sorted by employee name so that each occurrence is grouped together.REPORT SPECIFICS:1) This report reflects typical paryoll information.2) Certain columns have data that is either in text, general, or number ($) format3) The number of columns may vary depending on which PR report is being worked4) For the sake of simplicity - we can assume that the column titles will always be across row 15) Each employee name on this report may repeat several times depending on how many weeks they worked,so the SUM() formula should adjust automatically to capture all the rows of data to add up for each employee
HERE IS MY CODE TO INSERT 1 ROW Sub InsertRowAtNewNameONE()Dim LR As Long, i As LongLR = Range("C" & Rows.Count).End(xlUp).RowFor i = LR To 2 Step -1If Range("C" & i).Value Range("C" & i - 1).Value Then Rows(i).InsertNext iEnd Sub
NOTE: See below: I will format and add formulas where I need on the 1st blank row that was createdand I need a code that will copy this particular row to all blank rows to the last.
I have a protected template and unprotected source worksheets - - - what I would like to happen is for the macro to start and if the source worksheet cell B3 equals "Report Total" then stop - otherwise copy template worksheet then copy 6 specific cells from the source to paste values to specific cells on the newly created worksheet (B_ to C7, D_ to I7, E_ to C9, F_ to K9, A_ to C11, M_ to K11 and then K13=F13-30)
After that then start all over again unless the next row’s cell (B4, B5, B6, . . .) is "Report Total" then stop - - - the row count could be from one to a couple hundred.
Here is what I have so far but I know that with each copy the name will change and as it goes down the source file each row will change and I also need help with that.
My problem is as such; each month I receive an application for payment. This will contain around 20-30 worksheets. However I only need to interrogate around 3-4 specific ones. The worksheets I require contain data describing the plant/equipment a company has purchased, or materials purchased over a period of time. Each month the worksheets are updated with the previous months data appended to the bottom. I am required to established if the equipments have been purchased at the correct rate.
The worksheets are all protected thus in order to interrogate them I am required to copy an paste their contents into a new work book in order to format them and insert my new "assessment" columns. I need to keep the work sheets separate in the new work book as they have different layouts however they have the same layout and work sheet names each month.
I needs a macro which would allow me to open up a new book them copy the specific worksheets from a specific file into the new work book. I then have a separate macro which re-formats them into the layout I require.
What I have are dates in Column B with a lot of blank rows in between. For example: cell B2 has a date in it and then the next date would be on cell B54. I need a macro to copy cell B2 until it finds a new date (which is in cell B54) then copy the date in cell B54 until the next date again.. so on..
I have around 200 excel spreadsheets/workbooks with identical ranges but each with different data. There is a total of 5 columns and 225 rows in each spreadsheet/workbook. Looks something like this:
Title 1 Title 2 Title 3 Title 4 Title 5
A2 B2 C2 D2 E2
The Cells I need to copy are in BOLD. I am trying to paste them onto another workbook as follows
Workbook # File 2 File 3 File 4 A2 Title 5 A3 Title 5
As you can see, each workbook has identical A2 and Title 5 columns, so they only need to be copied once onto the Main workbook where data from the B and E columns are different for each Workbook. So not only I need to copy and paste from a Workbook onto the Main Workbook, but the code has be able to paste it onto a new row in the Main Workbook (where each row in the Main Workbook will correspond to the data copied from Workbooks 1-200.
I am new to VBA but I tried a code where I would copy and paste one cell at a time onto the same workbook and not onto the Main Workbook, and then how to copy and paste from one workbook to another, but as you can imagine that would take a long time:
It seems like I need some kind of loop, where it would copy and paste a set of cells and repeat the entire process until it reaches the end of the Workbook 1 while making sure when doing same thing for workbook 2, that the data pastes onto a new row onto the Main Workbook. I feel I have the logic down, but its in the syntax where I am failing.
What I am trying to do is to look at specific columns, then copy the data in that column from specific rows from sheet 1 (named TIA) to sheet Macro1. I think uploading a sample of the spreadsheet would be useful.
Unfortunately the spreadsheet is a living document and continues to grow in both column and rows.. The data extracted at this point is from row 7, 23-60 and copied into the new worksheet starting at A1.
1) Row 5 states the macro the column will be associated with. There can be more that one macro associated to a column.
2) When column is found, data from row 7 column (x) will be copied to sheet macro1 EX. If Cell G5 = macro1 then copy data from G7 to sheet macro1 at A1
3) When column is found, data from row 23 column (x) will be copied to sheet macro1
I have about 10 rows of data that have columns of information describing computer hardware and pricing. There are 10 rows, because each row represents a different country and different tax rates and pricing changes per country. So each column of a row has a specific formula to calculate information for that row's country information. All these 10 rows of formulas are kept as a reference at the bottom of the sheet.
At the top of the sheet I need to have a drop down menu to choose a country and then it will automatically copy and paste the row of that country to the current row at the top.
Is there any easy copy/paste macro for such a thing?
I have a workbook with multiple sheets named by month and year that I use to keep track of loans I work with at a bank. In these sheets I have info such as:
Column B = due date Column D = loan# A Column E = loan# B Column F = status Column H = followup needed (Columns A,C, and G aren't important for the current need)
What I am trying to do is create a main sheet (TRACKER) that all I will have to do is press a macro button and it will pull info for each loan that is in a pending status.
I need a macro that will search column F (Status) on all sheets and find each instance of "Pending" and once that is done, copy rows B,D,E, and H in each "Pending" instance and copy them to their designated area on my TRACKER sheet. After that is done I need it to continue to the next "pending" instance and do the same on the next available line on my TRACKER sheet.
The overall goal would be that everyday I can press the macro and it will repopulate the sheet with the current pending items (as each day I will change pending status' to complete and no longer need to track it the next day).
I already have the tracker sheet set up and ready to go with the spaces as follows: Column G&H = Merged cells where due date will need to go Column I&J = Merged cells where loan# A will need to go Column K&L = Merged cells where loan# B will need to go Column M thru S = Merged cells where followup needed will need to go
I have a worksheet template with details in cell A1,B1,C1,D1,E1,F1,G1,H1 & I1and when the sheet closes I would like to save a copy of the cell contents to a different workbook called transaction history, is there any way that vba code could write this to the workbook and when the transaction happens again, it then writes the new transaction data to the next row within the same workbook transaction history
I have Book1 (reference workbook) and Book2 (where i copy values from Book1)
Now I have macro to fetch the datas and paste the values in the format below.
But I can only doing this for one reference workbooks. But i need to add more reference workbooks in a file and paste to Book2. (etc: Book1, Book3, Book4, ....... to Book2)
Book2 looks like:
A1 B1 C1 D1 Name Adress Age Sex Ozan xxxxxx 27 M
Here' s the Code.
Option Explicit Sub TransferData() Dim wkb As Workbook, wks As Worksheet, LastRow As Long Dim FilePath As String, FileName As String Dim ws As Worksheet, blnOpened As Boolean 'Change these variables as desired...
A macro that will delete a tab or tabs in a file if and only if rows 11, 13, 23 & 25 are completely blank within that tab? So basically ALL rows would need to be blank, if there is any data within any of those rows, then tab should NOT be deleted.
I'm trying to figure out the if conditions for this relatively simple problem. Basically, this is an import from a word document where the table strays onto a new page. I want to try and repair this with a bit of VBA.
This is what it looks like:
1: cell 1 |the content should all be in this cell 2: |but the import sometimes splits it into two 3: cell 2 |
Basically if and only if cell Ax is blank (in this example A2), then I want the rows to merge each cell and repair the table.
The senior members have made it less intimidating to start writing code. Infact I picked up a DUMMIES book and a Macro book and it's been a lot of fun. Anyway here is my code that I have created thus far.
HTML Code: Sub ReportExtract() Sheets("Sheet1").Range("B2").Copy Destination:=Sheets("Sheet2").Range("C4") Sheets("Sheet1").Range("A2").Copy Destination:=Sheets("Sheet2").Range("C6") '
Essentially what I am trying to do is copy these cells from sheet 1 to sheet 2 and then save it as another file using the name of C6&"Text String *Report" This would essentially take the first record A2 - CL2 and then delete that record and move onto the next row 3 and loop through and create another file with the same name C6(Sheet2)&"Report Name" Sheet 2 is the template where the data from the rows will drop into. I have those called out above in the code. It works just fine. I'm stuck though with how to copy the file and move threw all the records and saving them as separate files. Just to make sure I am clear it's 1. Copy data from sheet1 to sheet2 (Template). 2. Then save that file with the file name as cell C6&"some text" concatenated. Loop through sheet1 grab the next record and rinse lather repeat. Just a few weeks ago I was struggled to create macros and now I can copy. Pretty weak I know but I really enjoy this, in fact I sold all my books and just have VBA material so I stay focused.
I am using Excel 2010 and basically i am trying to fill a range of cell with a green color if any value was enter in a specific cells. Example: I would like to fill range: A10:c13 with a green color (regardless of the cells content in this range) if a value was entered in cell C10 or C11 or C12 or C13.
I've tried conditional formatting but unfortunately I'll have to apply formatting for every cell and for a range of over hundred cells is not efficient.
i have a macro that opens 10 other workbooks and copies cells onto a "master" workbook. Until recently, everything worked fine. Suddendly, while it opens the 9 books and copies as it is expected, but when it opens the 10th wb, the macro breaks at a very simple copy/paste.
The weirdest thing is that after it breaks, I cannot select any cells neither in the opened wb nor in the master wb. This continues even after I press the "reset" button in the vba. So, I am only able to select objects (text boxes etc) in my wb and not any cells.
Also, the "arrow" icon on the design toolbar is not active. And I've tried pressing and de-pressing the F8 key, but I still cannot select any cells.
I have option explicit in the beginning of my macro. And i'm using excel 2003.