Selecting Column And Setting Criteria To Delete

Feb 15, 2012

I'm trying to delete a column based on a simple criteria. If the column contains no data it has to be deleted, but I really couldn't do it.

Code:
With Sheets("Test")
Columns("AH:AH").Select
If Columns("AH:AH") = "" Then
Selection.Delete Shift:=xlToLeft
Else
Exit Sub
End If

View 6 Replies


ADVERTISEMENT

Delete Multiple Columns By Column Name No Criteria Need, Just Delete Them

Jun 24, 2009

I would like a macro to find the columns named "apple" and "peach" and delete them. These would always be in row 1 but would always be in different column letters which is why I want the macro to simply find these columns by their name and not by their column letter.

And yes, I do mean the entire column altogether, shifting entire columns to the left. Wipe it off the face of the earth

View 4 Replies View Related

Selecting All Data In Specific Columns Without Selecting Adjacent Column

Mar 10, 2014

Using VBA, I need to Select A1:C14.

The problem is that A1:C14 contains blank cells, and there is also an adjacent column D that I do not want to copy.

So, UsedRegion and CurrentRegion aren't doing it for me. (It selects Column D too.)

Obviously, this is an example...the real data set is an export and varies in size.

View 1 Replies View Related

Delete Certain Cells Within Row Or Column Based On Criteria?

Nov 7, 2013

What i really need it to do is if each row in column H = "Cleared" then to only clear columns A, C to H. Theres a formula in B that needs to be left... any ideas?

Also i need this to work on all atbs as the commandbutton will on a master tab

VB:
Private Sub CommandButton1_Click()
With ActiveSheet
.AutoFilterMode = False

[Code]....

View 4 Replies View Related

How To Delete Entire Row Based On Criteria On A Column

Oct 19, 2011

Simple code that can delete entire row if certain criteria is met in a single cell

Example

I have a bank statement where under a first column (DATA TYPE), the cell could contain either "DATA" or "TOTAL"

How can I delete the rows contain the word "TOTAL" assuming the column is already sorted.

View 3 Replies View Related

Delete Rows Meeting Criteria In One Column

Jun 4, 2009

I have a large number of user inputs which is linked to a data sheet. In this sheet are rows to be kept and rows to be deleted. See attached example...

I need code to delete all other similar rows than the one with a number (1) in the field Complete. There can only be a number (1) in the field Complete in one of the rows.

But if there is no number (1) in the field Complete in any of the rows, no rows should be deleted.

The data sheet is to be transferred to Access afterwards.

View 3 Replies View Related

Delete Rows Meeting Criteria In A Column

Aug 11, 2008

I have searched for this topic, and I have read http://www.ozgrid.com/VBA/row-delete-criteria.htm, I don't really understand it though. I think what I want is simple, I want to search column A for cells containing the word " Total" - if any are found I then want to delete the corresponding rows.

View 2 Replies View Related

Delete Duplicate Rows Using Data In Column A As Criteria

Jan 13, 2009

I have a spreadsheet that has thousands of rows of data with maybe 6 columns.

I would like to remove the duplicate rows but the problem I am facing is that I would like to use column A as the criteria.

There are some duplicates in column A but the issue is that the data in column B, C, D, etc may not be the same for each duplicate.

Easier to see in this image:
http://img127.imageshack.us/img127/6364/datajv6.jpg

So A1 is the same as A6
A1 has data in B1 and C1, no data in D1
A6 has data in B1, C1 and D1

I need to delete either row A1 or row A6, it is irrelevant which row it is but one of them has to go.

View 2 Replies View Related

Formula To Delete Column If It Doesn't Match Criteria

Jun 2, 2009

I have a column of cells (Column I2:I1063) with zip codes in it and I want to keep the row if the zip code matches one on the list in a column B2:B100 on a separate sheet (Sheet1).

View 4 Replies View Related

Delete Rows Based On Criteria While Referencing Column Header

Jun 6, 2007

I'm trying to use VBA code to delete certain rows based on a couple of criteria as follows:

1) If column header is "TERMINAL NAME" and the cell value in that column is "BONDDESK", I need the entire row deleted.

2) Similiarly, if the column header is "PRODUCT TYPE" and the cell value in that column is "CORP", that entire row needs deleted as well.

The information is coming from another source, so the columns may change from day to day, i.e, "TERMINAL NAME" may be in Column L one day but in Column O another day.....

View 6 Replies View Related

Delete Entire Rows Where 1 Column Meets Multiple Criteria

Sep 17, 2007

I need create a macro to perform the following - I don't know if it needs to be an Excel macro or via VB. This is to speed a process up and eliminate any spreadsheet messing around for our "admin" staff - they are not good with excel at all!

So, I have a daily/weekly down load of a spreadsheet (exported from access).

* I want to copy the values of column AK to A
* Then delete all entries in column D that equal 19, 20 and 6
* Then delete all entries in column AL that equal "A","B","C" or "D" but not "E","F" or "G"
* Then delete entire rows where the value in column A is a duplicate within the list

I will call this spreadsheet, for the purpose of this exercise, the "Master". I now have another spreadsheet with values in that should relate to values in either (or both) columns A and B in the "Master". I need Spreadsheet 2 values to be highlighted as cross checked in the "Master" and then all those in the "Master" that do not appear in the 2nd S/S will be normal white cells thus showing that they need to be chased by our Admin staff.

View 6 Replies View Related

Setting Criteria In A Range

Apr 27, 2009

i would like to set a criteria bewteen a ranges. eg If A1 >0 but <100 then .3, Else If A1 >99 but <200 then .6, Else .9. How do i write this in the cell?

View 4 Replies View Related

Setting Criteria For Rows In Pivotttable

May 30, 2007

The attachment contains a small extract from a database, and an associated PivotTable. In the database certain cells contain 1 and are coloured, others contain 0 and their font colour is white. In the original these cells all contain formulae. I want my PivotTable to pick up only cells with a 1 (or more). So, in the example, only nine of the rows are useful and I don't want the other six. The rows I want of course depend on the year I select.

View 2 Replies View Related

Setting Up The Range In The Criteria Section Of Sumif Formula?

Feb 17, 2014

A B

17-Feb 5.00

19-Feb 12.00

22-Feb 7.00

26-Feb 10.00

I would like to see the sum of B given it is in the range from 17-Feb to 23-Feb. My estimations so far:

=sumif(A:A,????, B:B)

How do I set up a criteria which would take values from 17-Feb to 23-Feb?

I also tried =sum(sumif(A:A,{17-Feb;?;?;23-feb}, B:B) but it wouldn't let me.

Particularly the problem is in entering the date in the array.

View 1 Replies View Related

Run Time Error 7: Out Of Memory. Selecting Shapes To Delete

May 24, 2005

i have a macro which is executing some cleaning up and then copying information from project sheets to a summary sheet. the individual project sheets are (currently still manually) copied/moved into the big(ger) overview workbook. to support the work with the individual project sheets they contain a macro that is assigned to some (three) shapes. one part of the cleanup is stripping the macros off the individual project sheets:

' remove the traffic-light macros of the project sheets from all sheets in case of unwanted or uncontrolled "infection"
For CurrentWS = 1 To SheetCount
Worksheets(CurrentWS).Select
ActiveSheet.Shapes.SelectAll
Selection.OnAction = ""
Worksheets(CurrentWS). Range("A1").Select
Next CurrentWS

on the line "ActiveSheet.Shapes.SelectAll" i get frequently (not always... ) a run time error '7': out of memory. it happens on at least two computers. i closed all other SW. according to the windows task manager information there should be plenty of memory free.

questions:
- how to get rid of the error message? OR:
- is there another (more smart) way to strip the ("imported") macros, while keeping the "main" marco alive that does not lead to an error message?

View 2 Replies View Related

Selecting Autofilter Criteria From A Drop Down Menu

Jun 8, 2009

I am trying to create a macro that will run autofilter on another sheet when I select a number from a drop down menu, with that number being the autofilter criteria. I have tried the following code but it changes sheets before I can select the entry from the drop down menu.

View 2 Replies View Related

Selecting Criteria From Poorly Formatted Table?

Mar 7, 2014

Basically I have been presented with a table (which can't change) and isn't well formatted shown at bottom of page.

Ideally I want to like extract and cross analyise some of the elements in the table to load into a database. Due to the formatting I cannot find a way of doing this which identifies and picks out the relevant bits.

For example; how would I gather a way of identifying what the districts is, what the road type is (i.e motorway), whether it's rural or urban, and the totals for a number cross referenced factors (i.e total road lengths for Dacorum) based on the existing formatting?

I have tried indexing, vlookups, index, pivot tables, index match match ...all to varying degrees of success. Whilst these function to a degree if the table orders were to be formatted differently in the future these methods cease to work and I would have to check this manually.

Therefore if you can alert me to any possible way of picking factors based on criteria and then returning the results.

Example table (it has a number of headings and in a variety of positions within the page)...

Motorway and Trunk Roads
Principal Roads (De-Trunked)
(Route Length)

[Code]......

View 5 Replies View Related

Selecting Rows Based On Cell Criteria

Mar 19, 2005

I'm sure there is simple code for this but I have excel spreadsheets like the sample attached that are consistant in the types of fields but the only data I want to strip out are the rows where column A has a "G" in the cell, I tried using this

Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select

but this doesn't work when there is only one row of data. The number of rows with valid data will vary each day. I then tried an if, then statement and a loop but I could never get the loop to stop. I basically want a macro which parses through the worksheet and selects the rows that have that "G" in column A so I can copy them and paste them in another worksheet.

View 8 Replies View Related

Delete Rows Where Multiple Column Meets Multiple Criteria

Sep 29, 2011

Need to create a macro?

Delete rows where multiple column meets multiple criteria.

detail:
delete rows where
Column H is less than 10000
AND
Column C is empty(blank)

Those 2 criteria have to occur at the same time..

View 1 Replies View Related

Setting Column As Integer

Apr 17, 2007

I have written a macro to record some information to cells on a spreadsheet. Below is my code. As you can see I already have row setup in the code, but I now want to add column as an integer. So that if something were recorded in col m, then it would add 1 to colu and the next information would be added in col n.

Col = 13 (M) to start with.

Dim row As Integer
Dim colu As Integer

If Trim(txt(8, 10, 25)) = Workbooks("Book1").Worksheets(1).Range("K" & row) Then
MyScreen.Area(8, 4, 8, 5).Copy
MyScreen.Area(22, 40, 22, 41).Paste
SendKey "<ENTER>"
If MyScreen.Area(7, 57, 7, 57) = "A" Then
Workbooks("Book1").Worksheets(1).Range(colu & row) = Trim(txt(7, 57, 74)) 'getting my error here.. something wrong with colu
colu = colu + 1
End If

View 9 Replies View Related

Selecting Sheets Meeting A Criteria For Print Preview

Aug 31, 2006

I have a print userform where I let the user print a summary package of sheets. I am trying to allow the user to see a print preview of certain sheets. The first one is always the "Bid Summary" sheet (sheet 2). The rest are a dynamic number of sheets with numeric names starting at 1. Now I need a easy way for me to allow the user to see a print preview of the Bid Summary, and then all the sheets right afterwards. I cant use sheets("1","2",...).select because it wont select a ever changing number of sheets. Really it is a problem of selecting a varied number of sheets in VB.

View 3 Replies View Related

Setting Particular Formatting Style For Column?

Dec 3, 2012

I have an excel that gets updated monthly with new sales data. The sales data comes straight from our custom CRM system in a .xlsx file. All columns on this spreadsheet have a column type of general.

In the excel that is updated monhtly however their are certain columns that are set to a date type so that we can group pivot tables by date. Currently I have to paste the data that is exported from our CRM system into the monthly spreadsheet (beneath all the prior months data), create a new column next to any date field and then use the formula

Formula:

[Code] .....

I then have to take the resulting data and paste them as values over the original data so that it is in the correct format.

Is there a quicker way of doing this so I don't have to keep adding a new column and doing the forumula, can I somehow set the column so it automatically converts data in a general format to a date format.

View 1 Replies View Related

Setting Up Column Filters In Excel?

Aug 14, 2012

setting up filters or sorting for different columns in excel.

I am trying to make a database for my research. At the moment my cells look like this (this is just and example, the real list would be much longer):

Source
Policy

IEA WEO
RE Policy Global

IEA Clean Technology Tracker
RE Policy China, US

[code]...

I would like to put a drop down menu that allows me to search my sources. For example, I want to find 'IEA' in the 'Source' column and only entries with 'IEA' in the title pop up. Or I want to find 'Wind' in the 'Policy' column and only entries with 'wind' come up.

View 2 Replies View Related

Selecting Unique Column Items Into Seperate Worksheet From Column

May 19, 2006

In the attached file, details sheet contains multiple instances of project with associated costs for each of 2006, 2007 and 2008. What I need is a formula (preferably) or a VBA that select distinct project names and populate column B of summary sheet so I can do a sum if. The problem is the project names changes dynamically every week and they are practically in hundreds.

View 9 Replies View Related

Setting Column Chart Data Using VBA For Variable Ranges

Mar 10, 2014

I have some code to plot a column chart of data but it isn't working as expecting at the moment. The code is below. The variable binCounter is a count of how many cells in a range that I want to plot on the chart.

However, what I am finding is that the first couple of cells in the range appear as the series name with the rest appearing as the data in the chart. Secondly, the chart appears with the axis labels 1,2,3 etc when I have some custom ones I would prefer to use. How do I go about setting this property, as I can only find options on setting the axis title There is a lot of stuff on XY charts on Google but I can't find much on column charts unfortunately .

VB:
'activate sheet and chart
Worksheets("Home Page").Activate
ActiveSheet.ChartObjects("Histogram").Activate

'set variables for chart
With ActiveChart

[Code] .....

View 1 Replies View Related

Selecting A Part Of Text From 1 Column And Put This In A New Column

Oct 22, 2013

I need to put a part of a text from a column and place it in a new collumn. At this moment I use 2 columns and an extra sheet to solve this.

I have a collumn with a lot of data like:aaa-bc

bbb
abc-ba-bd
aa-bb
bbb-xx-yy
aa
abc-yy
klmn-zz
klmn-yy-ff

What I need is behind every cell a new cell with only the 1st part like:aaa

bbb
abc
aa
bbb
aa
abc
klmn
klmn

What I do now is use a new column with this formula:

[Code].....

And I made a translation table in which the 1st 4 characters are translated to what I want to see. In a 3d column I use

[Code]....

to get the results I need. Since I need to get results like this very often this method is very time consuming.

Is there a formula available I can use with only 1 new column?

View 2 Replies View Related

Selecting A Column

Jan 28, 2010

I need to select the whole column ABOVE the active cell. Ctrl-Shift-UpArrow is no good because it stops at the first blank cell. And selecting the whole column is no good either because when I subsequently paste into the column, it pastes in all the empty cells of the column, meaning my worksheets expands from a few hundred rows to 1 million!

Shift-Home does what I want on rows. Is there an equivalent for columns?

View 9 Replies View Related

Selecting More Than One Column

Oct 4, 2013

Cells(xrow, 3).Select --

Is there any way I can select more than one column.

I tried Cells(xrow, 3:10).Select but it gives error.

View 3 Replies View Related

Selecting Column By Its

Jul 3, 2008

I wrote a Macro that select info from Worbook "A" to Workbook "B". In that Macro tha columns B:B, E:E and F:F are selected.

The problem is that the layout is not always the same so the correct columns keep shifting positions. The only thing that never changes is the "Column Label" in the first Row.

So, no matter from which column I alway have to copy: "Order Date"; "Status" and "MetofPay".

Is there anyway to tell my macro to look for those columns instead of B:B, E:E and F:F?

View 9 Replies View Related

Finding Column Name Using VBA And Selecting Column After?

Jul 2, 2013

augmenting current code to select the column after a column. Current code is:

Code:
If Sheets(data_sheet1).Cells(2, iCol).Value = "Stations" Then TargetCol = 1
If Sheets(data_sheet1).Cells(2, iCol).Value = "Agency" Then TargetCol = 2
If Sheets(data_sheet1).Cells(2, iCol).Value = "Advertisers" Then TargetCol = 3
If Sheets(data_sheet1).Cells(2, iCol).Value = "Product Code" Then TargetCol = 4
The next line should find the column after "Product Code".

View 1 Replies View Related







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