Excel 2007 :: Macro - Copying Column In Which Number Of Rows Can Vary
Sep 23, 2013
I am using MS Excel 2007 and I am trying to create a macro which will copy column E and paste the data in column E to the bottom of column D. However each week the amount of rows in these column with vary, they will always be the same amount of rows in column E as in column D but there may be 20 rows one week and a 100 rows the next.
The formula I currently have is below but this will only work for a specified number of rows. How I could change this to work for any number of rows?
Code:
Sub IPT()
'
' IPT Macro
'
'
Range("E1").Select
[Code] .....
View 2 Replies
ADVERTISEMENT
Dec 18, 2013
My knowledge of Excel 2007 is minimal, from formatting individual cells, to creating column totals. I've used it for years in my household budgets. I have an attendance form which is about 3 pages long; currently, it's separated at page breaks, with column totals at the bottom of each 'page'. This is easy because the Row #s are infinite, right? Lately there have been regular adjustments, and I believe the project might be less cumbersome if it were spread out on separate sheets, but how to bring the rows of column totals to cumulative totals on the last sheet.
View 6 Replies
View Related
Jan 22, 2013
Excel 2007
ABCDE12145101843222121028543291410388563015104796731501058178325210
685894953107839104354108841011445510985111349661101215516710013135668
981417576999151858708916195971801720607291182161738219236274902024637
59121276476872228657786232425Sheet1
View 7 Replies
View Related
Jun 3, 2012
I want to count the number of duplicate rows where the exact text in columns A and B match. An example is as follows, where column C would be the desired result. Note that there are hundreds of different text values of column A and hundreds of column B, I just simplified the example.
Excel 2007
ABC1AX72AX
3AX
4AX
5AX
6AX
[Code] ......
View 9 Replies
View Related
Mar 5, 2013
I have a worksheet with four data columns A,B,C,D starting in row 2. I want to add between every row, exactly 11 blank rows. So if we have:
Code:
A B C D
1 5 3 4
2 7 6 3
3 9 1 3
the end result should be:
Code:
A B C D
1 5 3 4
2 7 6 3
3 9 1 3
Do I necessarily need a macro for this? Or is there another quick and creative way to achieve this result?
View 3 Replies
View Related
Nov 1, 2013
I've used the below, for example in Column E, the actual data starts in row 4, so I can't use the full E:E syntax:
=IF(ISERROR(INDEX(Data!E$4:E$65000,MATCH(9.99999999999999E+307,Data!E$4:E$65000))),
INDEX(Data!E$4:E$65000,MATCH("z",Data!E$4:E$65000)),
INDEX(Data!E$4:E$65000,MATCH(9.99999999999999E+307,Data!E$4:E$65000)))
The above basically checks for a number, and if fails (there could be #N/A, #DIV/0!, text, or Number-stored-as-text in any cell here), it checks for text. (the 65000 is arbitrary; we will never have more than a few thousand rows)
However this is not reliable--the main problem seems to be number-stored-as-text. And it's not possible for me to do the Paste-Special Multiply *1 trick to convert the numbers because this data is dynamically generated from a database--the user would have to do that every time the sheet opens.
Is there not some formula that simply says: "Give me the last non-blank cell after row 4 in column E, regardless of what type of data"? (Excel 2007)
View 9 Replies
View Related
Jan 23, 2012
I'm using this code to find values of "FEP MHS" or "LSD MHS" in column S and if column S containes either of these values it deletes the entire row from the spreadsheet. I need this to work on a spreadsheet that runs on a daily basis and each day it contains a different number of rows. I have used this code to successfully delete most rows that contain these values in Column S but for some reason it does not delete all the rows, typically leaving 6 - 7 rows that contain these values. I'm using Excel 2007 I need code that finds the last row used and deletes the entire row if these values are present.
Dim CelRSLHMHSD As Range, RngRSLHMHSD As Range, iRSLHMHSD As Long
Set RngRSLHMHSD = Columns("S").SpecialCells(xlConstants, xlTextValues)
For iRSLHMHSD = RngRSLHMHSD.Count To 1 Step -1
If RngRSLHMHSD(iRSLHMHSD).Value = "FEP MHS" _
Or RngRSLHMHSD(iRSLHMHSD).Value = "LSD MHS" _
Then RngRSLHMHSD(iRSLHMHSD).EntireRow.Delete
Next iRSLHMHSD
View 1 Replies
View Related
Jul 24, 2012
I am still new to this, and I pulled this code off of another site.
Background:
- Using Excel VBA, 2007
- I have a sheet that has a name in B6, has 4 blank spaces beneath, and then another name, 4 blank spaces, etc.
- I wrote a code to fill each of these 4 blank spaces with the value at the top of each
- The code works, but it won't fill the 4 spaces at the bottom of the column.
What is needed:
-how I can adjust to code below to fill in the 4 spaces beneath the last value in the column?
Code:
Sub FillBlanks()
Dim rRange1 As Range, rRange2 As Range
Dim iReply As Integer
[Code]....
View 3 Replies
View Related
Oct 22, 2013
I am trying to reformat the attached doc into one single column, It's a race listing of overseas marathons and I need it to look like this
Event Name
Event Date
City
Country
Entry fee
Website
in date order, one event after the other in a single column so I can flow it into a word doc ready to be designed. I need to apply in Excel (I am using 2007) to get this doc into the required format?!!
View 5 Replies
View Related
Feb 26, 2014
I need to transpose data from Column A to Row 2 and down.
The data in column A is in sections of 19 rows and then a blank cell and another 19 rows of data contimuously, It is a dynamic range and can contain many thousands of Rows.
The data needs to be transposed from Column A to row 2 (row 1 has the head line for each column) so the 19 lines of data is now spread accross 19 columns in row 2 and the next section from column A is spread accross the 19 columns in row 3 and so on.
My data looks similar to the below. (Test Number 0001 starts in A1)
Test Number 0001
21-Feb-2014
Kettel
Office
Demo
[code]....
I use Excel 2007
View 6 Replies
View Related
Jul 4, 2014
I am using Excel 2007 on Windows 7 Home Premium 64bit.
My Workbook contains 2 Worksheets, both with the same headings in row 1. Sheet2 is initially empty, except for the headings in row 1.
The following is a sample of the data in Sheet1:
[Code] ......
I want to create a Macro to operate as follows:
In the above sample data, rows 2, 4, and 8 are identical, so I want to copy rows 4 and 8 to Sheet2, and delete them from Sheet1.
Similarly:
Rows 3 and 9 are identical, so row 9 should move to Sheet2;
Rows 5 and 11 are identical, so row 11 should move to Sheet2.
Rows 6, 7, 10, and 12 are all unique, so should be unaffected by the Macro.
New records will be added to Sheet1 periodically, so the Macro will be used each time to move any newly discovered duplicates to Sheet2.
The Macro should make no assumption about how the rows are ordered, and should not change their order.
I have uploaded two Workbooks, such that Workbook1 shows the original data, and Workbook2 shows the result I want to obtain.
Attached Files :
Workbook1.xlsm
Workbook2.xlsm
View 14 Replies
View Related
Jul 7, 2014
Currently I am using Excel 2007. I want to merge data of alternate row of a particular column in Excel.Also i want to remove merged row. E.g.
Name City Pincode
John Mumbai
John 400009
Carol Delhi
Carol 110001
Carol Pune
Carol 411079
I want output to be ----->
Name City
John Mumbai-400009
Carol Delhi-110001
Carol Pune-411079
macro/formula for the above requirement..?
View 11 Replies
View Related
Sep 19, 2013
I have a big DB with several rows and columns.
Column B has several card numbers (e.i. 7987654345678)
Column C has a location name (e.i. madrid)
Column L has a date (the date is when the card was used)
What I want to do is identify the cards that appear more then twice on the same date and the same place.
Card Number
Location
Date
123
LOC
18/01/2013
[Code] .........
I would like through a macro or pivot to show me the results of the 2 last rows, because those are the only ones that are exactly the same.
I have excel 2007 running on Windows7
View 2 Replies
View Related
Mar 18, 2014
I currently have the following Macro for one of my many checkboxes in 2007 Excel:
[Code] .....
It works perfectly until additional rows are added/deleted before the indicated rows in the code (It changes the number sequence in the workbook). The number sequence stays the same in the code which means I am now hiding rows either before (delete rows) or after (insert rows) the intended rows I want to be hidden. Is there a way to change the above code to remain with the assigned rows regardless of the adding/deleting of rows before it?
View 1 Replies
View Related
Dec 19, 2013
a macro to insert rows based on certain cell values in column A.
I have uto 300 rows of data. Below is an example of column A.
R1
1
2
3
4
5
6
7
[Code]...
If (above the R) is an 8, I need to insert 2 rows above that R and directly below the 8.
If (above the R) is a 9, I need to insert 1 row above that R below, directly below the 9.
(Below the R there is always a minimum of 8 digits with the 9 and 10 being random).
I have excel 2007
View 5 Replies
View Related
Jan 11, 2012
I've already found a TON of threads about this process but nothing that matches specifically what I'm trying to do.
I have a spreadsheet that I'm using to auto fill other tabs with data that only matches specific criteria. Here's what I'm looking to do:
Columns I, J, K, and L may be marked as either Y or N (or blank). I have different sheets that require 1, 2, 3, or 4 of those columns to match Y. For example, on sheet 2 I want to copy the entire row if there's a "Y" match on column I and J. On sheet 3 I want to match "Y" against, I, J, and K. Sheet 4 I need to match only L, etc.
I need the data copied into the existing sheets to start on row 7. I have other data on rows 1-6 that cannot be moved.
I'm running Excel 2007.
View 5 Replies
View Related
Jun 20, 2013
I already have a Macro button built that hides values in column A. The next step I am trying to perform is a custom sort on column B in this order "Backordered", "Sourced", Shipped", and "Received". Here is my code that I have so far but where to begin adding in code to make this button sort.
Sub Inbound()
ActiveSheet.Cells.EntireColumn.Hidden = False
ActiveSheet.Cells.EntireRow.Hidden = False
Application.ScreenUpdating = False
[Code] ........
Excel 2007/Windows 7
View 1 Replies
View Related
Feb 5, 2009
You can always add numbers together. however, how can you vary columns based on a number?
for example, i can always do things like the following to change the number of rows selected in a column based on the variable numRows.
View 2 Replies
View Related
Mar 1, 2012
(Excel 2007). I have a report that I download which looks like this: The actual report has about 10000+ lines
I don't really want a macro for it but a formula that would copy the name in column A down in Column C but only to the point where the next name starts. So for example James Brown would be copied down in Column C till it reach Account Number 81914 and so on?
A B C
NameAccountJames Brown16836546259386014759716624957862380714557311623681914Steve Smith825168050422745213781459686708210378813700484308138459Holly Wood152663787051472924045442366165332455059500133525111211
View 5 Replies
View Related
Mar 24, 2012
I am running Excel 2007.
I have set up a table and for ease of explanantion Column C has a formulas in it to add together the values found in Column A and B.
EG C3 foumula = "=sum(A3+B3)"
Now in cols d & e I have manually entered figures and in colum F I want to add up those figures so F3 should read "=sum(D3+E3)"
In the past I have always been able to just copy the cell C3 and paste it into F3 and the formula would automatically copy and offset the various cells to the correct cells for the new posiitoning.
However, for some reason when I copy the cell, it now pastes the value only into the pasted cell and does not copy the formula, if I click on paste special to try to just copy the formula I now get a pop up asking me if I want to paste as Unicode Text or Text.
I have no recollection of changing any settings.
View 3 Replies
View Related
Jan 8, 2013
I am creating many tables in excel using a macro, and I want to copy them into a word document for later use. All the tables come from a long list, so for simplicity, they all get created on the same range starting at F1. Before deleting the existing table and adding the new one, I'm trying to copy/cut the table and paste it into a word document.
In case it makes a difference, I have office 2007
VB:
Sub ExcelToWord(LastRow)
Dim objWord As Word.Application
Range("F1:F" & LastRow).Copy
With objWord
.Documents.Add
.Selection.Paste
.Visible = True
End With
End Sub
View 6 Replies
View Related
May 22, 2012
I am trying to copy two columns to a different sheet in vba code. I will ultimately need to do this multiple times but I think I have the iteration part ok, it's just the copy part that seems to be wrong.
Code:
Worksheets("Lookup").Select
Range(n & lngRevStart & ":" & n + 1 & lngEndRow).Select
Selection.Copy
Worksheets(strDeptSheet).Select
Range(Columns(o), Rows(m)).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
The original code I used for this works great on one column but I knew the letter column each time I used it. Now I am trying to get two columns at a time and will be iterating through several based on user selections. I figure that will be faster to do both columns as the two columns are side by side.
I am getting an error on the PasteSpectial line "Run-time error '1004' PasteSpecail method of Range class failed.
I'm not sure where to go with this but I am assuming I have a problem with the Range selection lines on either the source or destination or both. The support is just for Macro errors.
View 1 Replies
View Related
May 29, 2007
i have data that will vary from item to item in the $ of rows associated
and the # of columns to be dealt with.
item1 Line 1
Line 2
Here i want to have a formula put and copied across X columns
item2 Line 1
Line 2 other data going across in the columns
Line 3
Line 4
Here i want to have a formula put and copied across X columns
item3 Line 1
item4 Line 1
get my meaning??
columns involved will be known before i get to this bit of code !!
as an example lets say it's 8 columns
using the record macro i get this bit of code
Range("E14:M14").Select
Selection.FormulaR1C1 = "=SUM(R[-10]C:R[-1]C)"
This is fine but i don't know what row or the columns are before i run the macro so the Range
("e14:M14").select wont really work.
I've sent sometime going through MRexcell searching for tips but found nothing also googled for dynamically pasting across unknown columns
this is close to my idea in my mind conceptually
Range("C2:C" & LastRow)
but it doesn't make the columns dynamic eg column 8 being = H and then P = 8th column on and the last with data.
View 9 Replies
View Related
May 12, 2014
I have 2 columns of data E and F. Column E has 11 different words that randomly repeat, Column F has 10 years of dates, about 1,000 entries (10/11/12 format). Both columns values come from formulas.
I am trying to copy cells E & F to columns K & L starting in row 2 only if there is is data in column E (one of the 11 words) and skipping all others rows. Both the E & F values of tthe row must be copied together, i.e if text is in E45, then copy E45 and F45 into column K and L starting with K2 & L2. This is a task which will be repeated multiple times as data is replaced in columns A-D.
View 4 Replies
View Related
Jan 7, 2012
I am using Excel 2007, here's my question:
I just wrote two macros that each produce separate text files (call them 'A' and 'B'). I want to open 'B' with Excel VBA, copy all of its contents, and paste that content into 'A' right after a specific location in 'A' (where I have 10 consecutive asterisks, i.e., **********).
Most topics relating to Excel VBA and .txt files have to do with either importing / exporting into Excel (not what I want), or with associating .txt files to Excel (also not what I want).
View 7 Replies
View Related
Feb 19, 2014
I have a situation that I cannot get my hands on. I have a set of Project Numbers in my Column A. (Will Try to post an example).
I need that everytime I change a number in my Column B that it will change all the numbers, in my column B, based on the matching Text in my Column A.
Demo1.xlsm
View 14 Replies
View Related
Jul 14, 2013
I have some data coming in from another source system which has the date format as "DD-MM-YYYY" but while pasting it to Excel (2007) sheet some date fields has just DD-MM-YY format which disrupts my macro. I did changing the language settings to "English(UK)" ,which i wanted, and changed the same in Excel options as well. But unfortunately it doesn't work.
View 3 Replies
View Related
Nov 5, 2013
I'm a 2007 user. I am trying to conditional format a range of F1:J10, where F1 will be conditionally formatted relationally to A1. G1 is relational to B1. H2 relational to C2, etc., all the way down to J10 relational to E10. My conditional format formula in cell F1 is >A1*2 (will format F1 as orange). I want to be able to copy the conditional formatting over so the formula in J10 for example would be: >E10*2 (will format it orange).
I omit the "$" in the conditional format formula in an attempt to prevent it from being absolute. But every time I copy the conditional formatting over to the other cells, the formula within those cells remains identical to the formula in the original cell.
View 6 Replies
View Related
Jun 16, 2009
I created a macro on an Excel spreadsheet:
Sub Macro1()
Range("C11:D19").Select
Selection.NumberFormat = "$#,##0.00_);($#,##0.00)"
Range("E5:E20").Select
Selection.NumberFormat = "0.00%"
Range("D24:E43").Select
Selection.NumberFormat = "$#,##0.00_);($#,##0.00)"
ActiveWindow.SmallScroll Down:=24
Range("D58:E339").Select
Selection.NumberFormat = "$#,##0.00_);($#,##0.00)"
ActiveWindow.SmallScroll Down:=57
End Sub
When the macro is run, it works with the exact amount of data that I've entered.
However, because I have specified a specific range, if I add a row or column of data to the spreadsheet and run the macro again, it throws the whole thing off (certain cells get formatted when they shouldn't and others aren't formatted)
How do I tell the macro to look in the spreadsheet for varying ranges of data and format those cells?
View 9 Replies
View Related
May 7, 2012
I am trying to develop a code which extracts the data from text files inside a folder (Folder test in my desktop) into one sheet. The Macro is in the workbook “Text Extract” which is an excel 2007 file. The data of each text should be copied to Sheet1 of this workbook one below the other. For testing purpose I have kept only one text file in the folder and was trying to copy the data from the text data extracted sheet to Cell A1 of Sheet1 of workbook “Text Extract”. The code works fine till copying the data, but shows below error in the line “Selection.Paste”:
Run time error 438: Object doesn’t support this property or method.
Below is the code:
Sub LoopThroughFiles()
Dim strFile As String
Dim strPath As String
[Code]....
View 6 Replies
View Related