Delete And Shift Cells Based On Cell Values

May 23, 2007

I have a spread sheet that has RX codes as field headers and ones or zeros as values. I want to find all cells which contain "0" and delete those cells while shifting the remaining cells left. The range of cells is aj1:dr17365 and the sheet name is "May 07 Rx HCCs"

View 8 Replies


ADVERTISEMENT

Search Cell If Blank Delete Cell Shift Values Up

Oct 22, 2009

The below code is what I have and it works but what I need is for it to loop until it doesn't delete anything. How can this be done?

View 2 Replies View Related

Delete Cells And Shift Up

Nov 7, 2009

I have data in cells A1:FM1326 I want to delete all of the cells that say FALSE and shift the remaining cells up.

View 5 Replies View Related

Delete Cells, Shift Everything Else Below It Up

Feb 6, 2007

I have a problem in making a delete function/sub and i'm applying it to a listbox in userform ... i'm trying to delete a row of data in the listbox which refers to cells (A12:D12) ... and at the same row (row=12), there are other data cells (E12:H12) ... after deleting the cells all other data below the deleted cells will shift up taking over the deleted cells ...

View 9 Replies View Related

Delete Range Of Cells And Shift Up

Jan 30, 2013

I am trying to delete a group of four cells and have the remaining block shift up. My code is below and crashes on the red. What is the right code to get this to work?

Code:

Do
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value = Range("G1").Value Then
Range(ActiveCell:ActiveCell.Resize(0, 3)).Delete Shift:=xlUp
Exit Do
End If
Loop

View 1 Replies View Related

Delete Row Macro (shift Cells Up Then)

Jul 1, 2007

I am looking for a macro that can delete whole rows (shift cells up then). How i would like it to perform is if there is nothing in cell(s) B then delete the whole row?

View 9 Replies View Related

Delete Cells Shift Left

Mar 15, 2007

I'm trying to do is check each Row and move the last 3 Columns of data in each Row to the left so they fall under the headings NHA2, NHA1, and OEM PN (Columns U, V, and W). Columns A and B are temporary. Column A utilizes the formula "= COUNTA(B2:AG2)" to count the number of cells in the row that contain data. Column B utilizes the formula "=COUNTA(C:C)" to count the total rows of data in the active worksheet. Columns A and B will be deleted at the end of the Macro.

The GOAL (END RESULT) is for Columns A through W (and ONLY these Columns) to contain data (keeping in mind that Columns A and B will be deleted at the end). If some rows have Column W (and beyond) blank, then I want to MOVE data from Columns U & V over to V & W and then COPY data from Column T into the [currently] blank Column U.

I've been trying to get the Macro to start in the last row and, using CASE Statements, delete the proper range of cells and SHIFT LEFT as it counts backwards towards the first row. I'm not too sure this is the best approach and could really use some advice from the experts! I can provide a "test" file if necessary ... the test file I've been working with is approximately 6.5MB, but I can delete most of the 14,287 rows and still give a good representation of how the data varies.

Sub b_DeleteCellsShiftLeft()
' DeleteShiftLeft Macro
' Macro recorded 3/14/2007 by George Nicholaou

' Need to assign variable for current row (?)
' r=ROW()

' Columns A and B are temporary
' Column A utilizes the formula "=COUNTA(B2:AG2)" to count the number of cells in
' the row that contain data
' Column B utilizes the formula "=COUNTA(C:C)" to count the total rows of data
' in the active worksheet
' They will be deleted at the end of the Macro
' What I want the Macro to do from this point is:
' 1. Check each Row and move the last 3 Columns of data in each Row to the left so
' they fall under the headings NHA2, NHA1, and OEM PN (Columns U, V, and W)
' 2. The GOAL (END/RESULT) is for Columns A through W (and ONLY these Columns)
' to contain data (keep in mind, Columns A and B will be deleted at the end)
' 3. If some rows have Column W blank, then MOVE data from Columns U & V over to V & W............

View 9 Replies View Related

Delete Empty Cells, And Shift Left

Oct 7, 2008

I am trying to find a method for deleting empty cells in a range and shift cells left upon deletion automatically. I could do this manually, but with 3000 rows of data it could be a long task. I have attched a small spreadsheet to show what I am looking for.

View 5 Replies View Related

Using VBA And If Statements To Delete / Shift Up And Insert Cells

Sep 7, 2012

I am trying to create a macro that will add and delete individual cells depending on an IF statement. The code that I created deletes/adds cells regardless of the IF statement.

If Sheet1.Range("F3").Value = Sheet1.Range("G2").Value Then
Range("G2").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End

ElseIf Sheet1.Range("F3").Value = Sheet1.Range("G4").Value Then
Range("G3").Delete Shift:=xlUp
End
End If

Also, what is the easiest way to have this code apply to all rows within column F, while adjusting the corresponding cells referenced in column G? The last row within the spreadsheet changes.

View 3 Replies View Related

Delete Empty Cells And Shift Remaining Left

Oct 7, 2008

I am looking for a method which would delete empty cells in a row, and then shift the remaining data to the left (filling the cells with data). I know that this could be done manually, but I need it completed for 3000 rows! I have attached a simple sheet to show what I'm Looking for.

View 2 Replies View Related

Delete Cell And Shift Left?

May 28, 2014

I want vba code to do the changes

Search for "CAP_ACTV_LN_SEQ" keyword in column A of Sheet1 and when found go two rows down and do the following

Delete cell D128 and E128 ( if more than 1 rows then do the same for all rows till "selected" keyword detected below it eg C131 in this case ) and Shift cells in the right to two column left as shown in figure below -

Before
2.jpg

After
3.jpg

Sheet attached

Data.xlsm

This can happen by click of button in the sheet

View 3 Replies View Related

Calculate Pay For Shift Work With Different Rates Based On Shift Hours

Apr 11, 2008

a person works for certain hours and get paid according to the hours worked either by day or by night or a mix of both. Day payment is $8 when worked between 08:00 and 19:59 , night payment is $12 when worked between 20:00 and 07:59. The excel cell are formatted as datetime with yyyy-mm-dd hh:mm , the function works fine in getting the time information and checking whether the whole work is all day or all night , yet the if-then-else statements for calculation seems to be wrong!!

examples:

start = 2008-01-01 09:15 , end = 2008-01-01 11:40 , all day as it is between 08:00 and 20:00 and cost = 8/hr = 19.333

start = 2008-01-03 21:05 , end = 2008-01-04 02:05 , all night as it is between 20:00 and 08:00 and cost = 12/hr = 60.000

start = 2008-02-02 19:00 , end = 2008-02-02 20:05 , cost = 9.000 as 1 hour day = 8.000 plus 5minutes night = 1.000

Function prod(st As Date, en As Date) As Double
Dim shour As Integer
Dim smin As Integer
Dim ehour As Integer
Dim emin As Integer
Dim stod As String
Dim etod As String
pday = 8
pnight = 12
shour = Hour(st)
smin = Minute(st) + shour * 60
If (shour >= 8 & shour < 20) Then
stod = "day"
Else
stod = "night"
End If
ehour = Hour(en)
emin = Minute(en) + ehour * 60
If (ehour >= 8 & ehour < 20) Then.................

View 8 Replies View Related

Shift Cells Left Based On Text Value

Oct 20, 2009

I need assistance in shifting cells to left based on three (3) specific text values in column B. There are tons of data and extra lines and stuff but consistently these three (3) text values are consistently not aligned and I simply need to shift entire row 1 space to the left. I can do the long and tedious process of going through them all but is there a macro which I can play that does it instantly...

View 9 Replies View Related

Excel 2010 :: Delete Duplicate Rows Based On Values Of Cells

Jun 17, 2014

I'm new to VBA and macros, using Excel 2010, and am trying to figure out how to delete all duplicate rows in a sheet where 2 or less of their values in column A is "1". I'd like have a script that is flexible enough to change to 3 or less if need be. I also have a header row that needs to be offset in the process.

A---B-
0--123 <-delete
0--123 <-delete
0--123 <-delete
1--123 <-delete based on this the value of column A
0--123 <-delete
0--123 <-delete
1--321
1--321
1--321
1--321
1--321

or

A---B-
0--123 <-delete
0--123 <-delete
1--123 <-delete
1--123 <-delete based on this the value of column A
0--123 <-delete
0--123 <-delete
1--321
1--321
1--321
1--321
1--321

View 5 Replies View Related

Delete Columns Based On Cell Values

Feb 6, 2008

I have a standard data import that populates data in columns A through DC. I am trying to delete those columns from BX through DA where the value in row 2 equals 0.

View 4 Replies View Related

Delete Duplicate Rows Based On Cell/column Values?

Oct 28, 2009

I have a excel file which contains dublicate rows. The duplicate rows can be identified based on few cell/column values. I need a macro to delete the duplicate rows when the below condition is satisfied: let us consider row 5 and row 6:

If column 7,12,13,16,17,18,19,23,24,27,28,29,30 in row 5 = row 6 then row 6 has to be deleted. This condition has to be followed for all other rows in the excel used range. Have attached the sample workbook.

View 5 Replies View Related

Delete Cell And Shift Cell Up

Jan 22, 2007

I have data in cells A1:A4. I want if cell A2 is deleted using the button delete, the cell will automatically shift up. Can a macro do this?

View 12 Replies View Related

Date And Time Based On Shift In Cell

Jan 8, 2009

If I use =now() in a cell it will enter the current date and time. For shift workers, this does not work.

I'm tring to figure out a formula that will only change the date at 6:00am every day. This way a person working the night shift will not see a change in the date on his sheet at all, only the day worker.

View 5 Replies View Related

Shift Cells Up If Cell Equal 0

Dec 27, 2008

In the range A1:Y66, for every cell whose formula returns a 0, I want it to delete that cell and shift the cells up.

Here is the code I tried, but nothing happened:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column > 25 Then Exit Sub
If Target.Rows > 66 Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
If Target.Value = 0 Then Target.Delete Shift:=xlUp
End Sub

View 9 Replies View Related

'shift Cells Right' Depending On Value Of Cell

Jan 4, 2010

I need a macro that will "examine" the text of column B for every row checking to see if the text "Proper Text" is in the cell and if not, execute this code for that cell and then move on to perfrom the same until it finds an empty cell:

Selection.Insert Shift:=xlToRight
Range("B2085").Select
ActiveCell.FormulaR1C1 = "Click for detail image"
With ActiveCell.Characters(Start:=1, Length:=22).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic

Note that "B2085" above is the cell number that the script stops on to execute this code.

View 9 Replies View Related

Generating Values In Number Of Cells Based On Adjacent Cell Values

May 22, 2014

What I have In Column B, I have the datesIn Column I, I have engineers name What I need I want a macro to generate Serial Nos. (1,2,3....... n) in column A If an only if the date in column B is today's date and the engineer's name matches with the PC's username

The following is my code

[Code] ....

Above code runs without errors but does nothing.

View 4 Replies View Related

Delete Row And Shift It Up If Value In Column

May 15, 2014

How would write a macro that would delete a row and shift up if they have a value in Column A?

View 6 Replies View Related

When Protect The Sheet - Delete And Shift Up Disable

Aug 8, 2013

I have a sheet,i want the users unable to select any cells,but a column is free to select an change and enter the inputs. I want to delete and shift up zero cells on that free column,but this property is disable when i protect the sheet.

How I protect other cells from selection and change,and enable delete and shift up for the column that not protected.

For example: I have the attachment file,every column is protected except column "H". I want a macro to when I clear content of any cell in this column,every cells shift up and every non zero cell put from row 1 to... and after them zero cells put.

View 2 Replies View Related

Compare Dates In Rows - Delete Then Shift Up

Mar 14, 2012

I am fitting 2 sets of data to match eachother. I want to have as much data as possible but only for the same dates of each dataset.

I have 4 coloumns.
Dataset 1: A is date B is data
Dataset 2: C is date D is data

I want to compare A vs B one row at a time. If they are not similar it should delete and shift up the values in A+B or C+D according to the lowest value (date) of A vs B.

Remember that if the macro just deleted and shifted up it should compare the same (undeleted) value against the new value that just shifted up in the other coloumn.

View 2 Replies View Related

Colour Cell Based On Few Conditions / Cell Values Of Other Cells In Same Row?

Jun 28, 2014

In the xls for each step I have 2 raws-planned and actual. Step planned duration is populated manually over the weeks.Before that row we have another reflecting the actual step status per week

I would like to find a way how cell reflecting the actual status of a step can be automatically populated (coulored) based on the colour/value of activities that are planned for that week and for that step.Activities are listed below the step and again have planned and actual row.

The rule should be : if for a week we have several activities all of them should be finished in order to have step stataus auto populated as green. If a single activity planned for that week is not done-then weekly step status should be red.

The activities for each step are grouped below the step. It seems that one of the difficult part in that request would be how formula will understand where starts and finishes the activities that belong to one step. To get that happen I placed a column showing step and another column where we activity.

View 9 Replies View Related

Copy Cell Values In One Cell Based On Value Of Adjacent Cells

Feb 20, 2014

What I want to achieve: those cells have number 1 ( in column E) , adjacent cell values ( In Column D) are copied to G12 in the following format:: Mark,Lark ( i.e. cell value , cell value, etc)

is it possible ( with a command button) Sample attached

View 4 Replies View Related

Fill In Cells Based On Other Cell Values

Dec 21, 2009

I am looking for a way for Excel to fill in cells in a column that has data sporadically in it. I am importing a text file into excel and saving it as an Excel file.

In the example attached, I need the numbers filled in all the way down to the next number. I don't care about the text, just the numbers. I realize I can copy and paste, but these files can be several hundred rows long and it seems there should be a better way.

View 4 Replies View Related

Change Cells Address Based On Values In Another Cell?

May 5, 2014

I would like to have a cell (A2) with "H" in it. then have another cell with something like =A2&"2" which would equal H2 and actually reference cell H2?

View 1 Replies View Related

Automatically Enter Cell Value Based On The Values Of Two Other Cells

Jan 8, 2010

I am working on blood pressures. I want cell C1 to place either, "Prehypertension","Stage I Hypertension" or, "Stage II Hypertension" depending on the values of cells A1 or B1 ....

View 7 Replies View Related

Clear Cells In A Range Based On Other Cell Values

Jun 6, 2012

I have two rows of numbers, say D1 to F1 and D2 to F2. Row D2 to F2 will always have lower values.

The range below it is D3 to F100. I want the range to clear the contents of the cells in the range where:

a) the cell is > the x1 cell above it

OR b) the cell is < the x2 cell above it

If it is = or between the two cells, the value stays.

Example:

If D1 thru F1 is 4, 5, 7 and D2 thru F2 is 2, 4, 3, then:
D3 is 5, it is cleared
E3 is 4, it stays
F3 is 5, it stays
D4 is 2, it stays
E4 is 1, it is cleared
F4 is 9, it is cleared
Etc

Basically, the cell in the range looks up its own column, compares itself to x1 and x2 in that column. If it's greater than or less than, then it clears the contents, if not, the value in the cell stays.

View 3 Replies View Related







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