Macro Optimization And Moving Text From One Column To Another And Deleting Previous Column

Nov 7, 2009

I am running Win XP and Excel 2003.

I have a macro I found here on the boards written by Lenze to delete an entire row based on what is found in column A. I would like to delete any row where Col. B contains 10 or less characters and I have modified it to do so (or at least I think it does). My problem is that it takes about 12 minutes to run the macro (I have about 50k lines to run through). I was wondering if this is the fastest method or if it examines things other than just column B.


Sub Test()
Dim i As Long
LR = Cells(Rows.Count, "B").End(xlUp).Row
For i = LR To 2 Step -1
If Len(Cells(i, "B")) < 11 Then Cells(i, "B").EntireRow.Delete
Next i
End Sub
After this runs, I am left with Columns A to somewhere around AH. The columns are generally in the format of text followed by a numeric column. An individual text column has the same name through all of the rows. The numeric columns have varied values whether negative or positive.
Ideally what I would like: If a given cell (ie. C2) in Row 2 is numeric, then copy the cell to the left (ie. B2) into (ie. C1) and then delete Column B. I need this to work for multiple columns from B to C, skip D and E, and then from F to AG (and maybe beyond).

View 9 Replies


ADVERTISEMENT

Macro To Copy Data From Previous Column Into Next Free Column

Aug 20, 2014

I have a spreadsheet which is updated daily. Row A of the sheet has the date in it, and every day a new column is created for the that set of data. I have the below code which works at the moment:

[Code] .....

I want to use this same code on another spreadsheet to do the same process (I need to copy and paste 4 columns (A,B,C + D, into E, F, G & H, then tomorrow it will copy E, F, G & H into I, J, K &L etc etc)). The problem I'm having is that A1:C1 is a merged cell, then D isn't (used as a border to separate). So when it is copied I need to select the merged cell columns and column D (i.e. A:C & D on day 1) and paste it into E:H with E1:G1 merged.

View 5 Replies View Related

Moving Text After Particular Character To Next Column

Oct 23, 2008

At this point, I have a list in the first column that looks something like the following:.......

First, I want to delete any cells that have two or more '' characters and delete any cells that do not have any text after the first '' character. Then I want to take the text before the character and put it in column B, deleting the ''. Once I have done these things, my original post and this one can be marked solved.

View 5 Replies View Related

Macro - Moving Active Cell To Column B Of Next Row

Feb 14, 2012

I use this macro to open a hyperlink in "column B" of the next row. However, it only works if I begin the macro from "column N" on the line above. (the hyperlink is always located in column B)

I want to be able to run this macro from any cell on the line above. How to modify it?

Code:
Sub Open_Hyperlink()
'
' Open_Hyperlink Macro
'
' Keyboard Shortcut: Ctrl+o
'
[Code]...

HTML Code:

ABCDEFGHIJKLMNO
1ActiveURLWhatDateFirst NameLast NameOtherOther2Other3Street1CityStateZip
2XLinkData112/21/2011BobSmithData2Data3Data4123 MainMooresvilleNC28117
3XLinkData112/22/2011LarryJonesData2bData3Data4456 MainMooresvilleNC28117
4XLinkData112/23/2011MaryAkinData2Data3Data4789 MainMooresvilleNC28117
An example would be to run it while Cell "I2", "J2", or "K2" is selected and have it open "B3"

View 2 Replies View Related

Macro To Paste In Certain Column, Moving Over Each Time

Mar 31, 2007

I have this macro listed below that finds all these files, copies cells from stat sheet and places them in sheet1 in another file. It keeps looping till all is found and done.

My problem is when it goes to paste in sheet 1 I want it to shift over a row each time.

Right now during the first pass it pastes in column B, I want it to start in column D

The issue seems to lie right under where it says "Put data into workbook"

Public Sub PullData()
Dim wkb As Workbook
Dim lngStore As Long
Dim strDate As String
Dim strName As String
Dim Book As String
Dim Sheet As String
Dim week As String
Dim Store As String

Dim IngRow As Long
Dim strCol(0 To 15) As String

strCol(0) = "b"
strCol(1) = "c"
strCol(2) = "d"
strCol(3) = "e"
strCol(4) = "f"
strCol(5) = "g"
strCol(6) = "h"
strCol(7) = "i"
strCol(8) = "j"
strCol(9) = "k"
strCol(10) = "l"
strCol(11) = "m"
strCol(12) = "n"
strCol(13) = "o"
strCol(14) = "p"

View 9 Replies View Related

Function To Put In A New Column To Get The Abbreviated Year And Month Of A Previous Column In The Same Row

May 18, 2007

Is there a function to put in a new column to get the abbreviated year and month of a previous column in the same row???

Ex. Row A B C D
3/14/2007 5/16/2007 2007-3 2007-5

Instead of using the YEAR MONTH funcion for each row is there a universal function that I could designate to the whole column of C and D something like C=YEAR(A(row#))???

View 3 Replies View Related

Insert And Fill Column Up To Where Data Is In Previous Column

Nov 23, 2012

I am after a macro to insert a column lets say between column A and B. Once column inserted new column B should be filled by a text say "January" but it should be only filled upto the data of column A so if column A has data upto A600 then column B should be filled from B1 to B600.

I tried recording but it fills data upto B65000+.

View 2 Replies View Related

Calculate Average For Column Based On Moving Start Column?

May 3, 2013

I have a pivot that includes customer data and I need to create an average for each row based on the first populated column for each customer. After one month of units appears for the customer, I need to calculate the average going forward, and if there are blanks after that they should be treated as 0 in the average. Below is an example of my description of the pivot.

Jan Feb Mar Apr
Customer #1 1 1 3
Customer #2 1 3
Customer #3 2 2

So, the average for customer #1 would be calculated from Column B to Column E, and factor column D as a 0 in that calculation. Customer 2's average would start in Column C and go to Column E, and factor column E as a 0 in that calculation. Customer 3's average would start in column D to column E.

View 5 Replies View Related

Moving And Deleting Entire Rows Between Tabs In Workbook And Moving Them Back If Needed

Sep 23, 2013

I have an excel work book with 6 tabs. I would like to have Excel move an entire row from one tab to another tab (removing the row and inserting it in the other tab). I.e. Example I have a tab with items that are marked as "Open Actions" so if I were to change the drop down to close. Excel would move that entire row of actions to the tab with the "closed actions" and insert into the next available row. Now if someone were to come back at a later date say no it should be reopened than I would change the drop down to open and excel would move that row back to the open actions tab into next available row. I tried a PIVOT table and no good I played with few macro and not.

View 5 Replies View Related

Setup A Macro To Copy Text From A Column Of Cells To Another Column

May 22, 2008

I have been working with a few people on here to setup a macro to copy text from a column of cells to another column and then print this in to a text document but it seams to have got stuck in a loop ....

View 9 Replies View Related

Macro - If Cell In Column Is Blank Then Input Text Into Same Row In Another Column

Sep 19, 2008

I am looking for a Macro that will search a column for blank cells, and when one is found will add text to the same row in another column. For example: The below is a spreadsheet. I am trying to find something that will search through column "C" in this case and add text (of my choice) to Column "A" if the cell is Blank. So Since cell C1 is Blank then Type "ERROR" is cell A1.

A B C D E
1 X X X X
2 X X X X
3 X X X X X
4 X X X X
5 X X X X

View 9 Replies View Related

Macro To Input Column Fields Into Text Within Another Column

Jun 8, 2009

This macro is extreemly basic but i have no skills in excel with macros. Basically i have 'Column A' with stats that i need input into 'Column B', however i need then to be input inside a field that is already there.....

View 4 Replies View Related

Macro To Find Last Row In Column B And Text To Next Column

Sep 3, 2013

I have a macro that copies data from one sheet to another. I would like getting the macro to figure last row used in column B from B3 on and put the word Sum below it. For example, if last row used is B64, on B65 would like the word sum on it.

I cannot just input in as the number of rows could change when macro is run. Data is dynamic.

Here is simple code I have:

Sub Weight()
Sheets("Final Month").Select
Range("A2:B1055").Select
Selection.Copy
Sheets("Final Weight").Select

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

View 2 Replies View Related

Create Macro That Filter Date In A Column From One Week Previous Till Current Date

Mar 14, 2014

I have an excel sheet wherin there is a column that has the data where in the dates are displayed and many other columns.

I get this excel every Thursday so i want to filter this date column in such a way that it give me the data related to the date of the previous week only yet there is a catch here. When i say previous week i mean.

Suppose today is 03/14/14 then i want the data from 03/07/14 till today ie Last week friday to this week full( so cant use Current week option) and then paste it in a new sheet.

I tried the Record part but in that it is taking a hard coded value as i am selecting the date myself. I dont want to change the date manually every time.

this was the macro that was created

Code:
ActiveSheet.Range("$A$1:$BX$58").AutoFilter Field:=1, Operator:= _
xlFilterValues, Criteria2:=Array(1, "3/10/2014")
Range("A59").Select
ActiveCell.FormulaR1C1 = "=COUNT(R[-4]C:R[-1]C)"
Range("A60").Select

View 8 Replies View Related

Lookup Formula For Previous Column?

Jul 26, 2013

I have a column of numeric values in column B. I have the date that corresponds with each value in column A. I am using a max formula to find the highest value in column B. What could I use to return the date of the highest value from Column A?

View 2 Replies View Related

Sorting According To Previous Column Sorts

Sep 22, 2006

I need a macro or some idea on how to sort the following numbers (I hope this makes sense!)... The problem is with the zeros get sorted to the top (or even if I have blank cells sorted to the bottom) and I need them to ignore the zeros and sort according to the value in their column but not any other column. However, I need them to be sorted in order from D, C, B, A.

A B C D
0000
4000
101000
0540
0050
6660

ie I need them in the following order.

A B C D
0000
4000
0540
0050
6660
101000

Therefore they need to sort based on the following columns.

This is because I am charting the values in a column clustered chart that need to be in ascending order.

View 4 Replies View Related

How To Arange And Count Various Numbers In Previous Column

Jun 4, 2007

Let's say there is a one column with 9 cells. I need in another column to be aranged various numbers in previous column and in another column to be counted every number how many times appears.

Below is one small example of what I need.

4 2 2
8 4 3
10 8 2
4 10 1
8 15 1
15
2
2
4

View 9 Replies View Related

Save Previous Cell Value In The Corresponding Row Of Different Column In Same Sheet

Apr 4, 2014

I found some VBA code that saves the previous value entered into a cell and displays it as a comment. I've attached that workbook as an example, but I want to change 3 things.

1) I only want to capture the previous values from Sheet1.Column1 (you'll see the example captures changes on the whole sheet1).
2) I want to 'paste' the previous value of Sheet1.Column1 in the corresponding row of Sheet1.ColumnD (i.e. the previous value of A5 will be displayed in D5). The code currently pastes the value in the corresponding address in sheet2.
3) I do not need the comments part. Simply displaying the previous value in the corresponding row of Sheet1.ColumnD is good enough.

View 2 Replies View Related

Move Every Other Cell In A Column To Row Above It Then Delete Previous Row

Jul 11, 2014

I have a spreadsheet that I need to rearrange to improve readability. I have an example attache, which is easier to understand than describing it, but I'll try:

I want to start in a1, move to a2
copy a2 to b1
delete line 2 (the previous lrow 3 now becomes row 2
if a2 > 0.01, skip it and
move & select cell a3
... and repeat the above logic, on the next series of cells...

E.g.
copy a3 to b2
delete line 3 (the previous lrow 4 now becomes row 3
if a3 > 0.01, skip it and
move & select cell a4
...and repeat the sequence again.

View 2 Replies View Related

Find Value And Then Copy Info From Previous Column

Feb 15, 2010

I have a spread sheet with bunch of rows and columns. Columns goes all the way from A ... BB and rows from 1 to 40,000

The main focus is column Y and AC

If there is a value of FALSE found in column Y then macro should go to previous row and copy the value that contains in column AC and then move down to the next row, , where the value FALSE was found and that's in column Y and paste that value in column AC the NUMERIC VALUE

Below is the data ...

View 9 Replies View Related

Moving Last Word From One Column To Another

May 3, 2007

I have a list of peoples first and last that I am trying to import into another application. My problem is that the application wants the first names in column A and the last names in column B. Right now my excel has the first and last names in the A column. I would just copy and paste, but there are 2,600! I just want to move the last word in column A to column B...

View 13 Replies View Related

Moving Values From A Column To A Row

Jan 18, 2010

Is there a quick way to transfer the values from a column to a row? If so, does this have to be for the entire column or can you select part of the column and transfer it to a row?

View 2 Replies View Related

Moving From Colums B To Column A

Jun 6, 2008

how do I move the codes (1CH,1CL,1CP,1EM) from Column B to Colum A under Fee Earner cells where opposite the dates by using a macro?

View 9 Replies View Related

Moving Cells From A Row To A Column

Aug 26, 2009

it is possible to move a row of cells with (names in each cell) to a column. Basically, I want the list of names to go from top to bottom rather than left to right.

From this (each name is in separate cells)
John Jones Bob Smith Jane Morgan

to this:

John Jones
Bob Smith
Jane Morgan

View 9 Replies View Related

Conditional Format To Mark Increase From Previous Column

Sep 5, 2013

I have a goal set for the year. With conditional formatting, each month will be set to either red or yellow based on where it stands in relation to the goal. I would also like to show an increase or decrease in productivity for each month. I tried to use conditional formatting with the formula:

=IF(C2=D2, "", IF(C2<D2,"↗","↘")).

The formula works on its own without the conditional formatting so I am not sure what I am doing wrong. I've attached a sample with all the conditional formatting and formulas in place.

View 5 Replies View Related

Sum Alternate Columns Base On Previous Column Entry

Jun 14, 2007

I am trying to resolve a calculation issue where I want to sum accross columns depending on an entry in the column immediately preceeding. The layout is an Attendance sheet, The columns are for the days of the Month ( 1 - 31 ) and the rows are the Months. There are 2 columns associated with Each day. The first column is for the type of Time Off ( Vacation, Sick, Personal, etc ) the column next to it records the number of Hours some one took off. The work book has a Sheet for Each Employee and a running total needs to be maintained for the amount of "off time" each employee takes by the various time off categories. I have tried setting up range names but this won't work as there will be multiple sheets. I believe the problem is the mixture of Text and Numeric data but could not resolve.

View 3 Replies View Related

Moving Active Cell In Same Row To Column A

Jun 28, 2009

In my macro, I need to, from any column, move the active cell to column A, while remaining in the same row.

View 2 Replies View Related

Moving Rows Into Specific Column

Sep 10, 2009

I need to move a number of rows, based on user input
in front of the first column, continuously until it 'flattens out' into one row..
And then do the procedure again for the next row
Kinda hard to explain.. maybe i'll use an example
using this matrix :

View 8 Replies View Related

Finding Certain Criteria And Moving It To Column

May 19, 2007

I need to look at column B find anything that Starts with BBX (ie; BBX124343, BBX1348383 ) and move it at the same location only to column A

View 9 Replies View Related

Moving Data From Column A To Rows

Jan 9, 2008

I have data that is all in column A there are 8 pieces of information.

So client 1 info is listed from A2-A9, client 2 from A10-A17 etc. etc.

I set up A1-H1 to be the headers necessary.

How do I go about moving A2-A9 to A2-H2, then A10-A17 to A3-H3 etc. down through all the contacts which go down to A2400...

View 9 Replies View Related







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