Deleting A Selected Row

Feb 22, 2007

I would like to run a macro that will delete the selected row in a protected worksheet but only delete it if the row does not have locked cells. I want users to be able to delete the rows they no longer need but only be able to delete them if the row does not have formulas that are locked.
BTW-I am working in an older version of Excel.

View 12 Replies


ADVERTISEMENT

Deleting Selected Pictures

Nov 2, 2008

I have a worksheet into which have been imported a number of pictures, The pictures have all been imported and sized to appear to fit into cells. I have a program which deletes all of the pictures in one go but I would like to be able to just delete all those in one row. I'm not sure how to address the row as I believe pictures are objects sitting on top of the sheet and not actually in the cells
What I have tried is:

View 3 Replies View Related

Deleting Selected Data Based On Cell Value?

Oct 23, 2013

I have attached a sample file.

There are two sheets Stock and BrancnID The stock sheet has a very huge date ( approx 30000 ). The Stock Id of all the records are unique. Every day I get the Stock ID numbers only in excel format from different branches. Every day I have to match the ID numbers received and delete its data in the Stock sheet ( to get an idea I have shown this in sheet3 ).

Is there is any code where I copy paste the ID numbers from the varoius excel sheets into my excel file in the BranchID sheet and the data gets deleted. i.e as I paste the data the record gets deleted but not the Stock ID number. Also the next day when I get new ID numbers and I delete the old ID numbers from the BranchID sheet the data should not re-appear in the Stock sheet.

View 4 Replies View Related

IF / THEN Macro For Deleting Rows Except Selected One And Header

Sep 18, 2013

My excel contains first 5 rows of heading information and the rest of the rows contain the data. I want to select a specific row from the data and run a macro that would delete all other data containing rows.

This is what I have now:

Code:
Sub DelRows()
Rows(6 & ":" & ActiveCell.Row - 1).Delete
Rows(7 & ":" & 65000).Delete
End Sub

Everything is fine if I select any data row except the first one (R6). In that case, the macro doesn't work as it should, deleting a row from the heading ones.

View 1 Replies View Related

Fill Range Of Cells With Text When Listbox Option Selected - Clear When Not Selected

Jul 25, 2014

I am using this code to hide or unhide rows of text on another sheet:

VB:
Sub ProcessSheet1ChangeOnCellJ7(ByVal Target As Range)

Dim sAddress As String
Dim sValue As String

'Get the address of the cell that changed without '$' signs
sAddress = Target.Address(False, False)

[Code]....

When the "Not Pursuing" list box option is selected (in cell "J7" or "J8" in Sheet 1) I need to add (or over-write) "Not Pursuing" to the range of cells in column "B" (in the "Tasks" sheet), but only for that particular Goal, meaning a limited range of cells in column "B". If the "Pursuing - Show All Tasks" option is selected for a Goal then these same cells need to be blank so that the appropriate person can enter their name into the cell.

The purpose for adding "Not Pursuing" automatically to these yellow highlighted cells is that it will facilitate filtering of tasks by individual in the "Tasks" sheet..

Again I have tried several times to upload a sample file and am unable to, which I know makes it more difficult to solve. (Is there some common mistake people make? I know it's an allowed format and is very small in file size....)

Code solution can be entered directly beneath:

VB:
If Target.Value = "Not Pursuing" Then
ActiveWorkbook.Sheets("Tasks").Rows("29:29").EntireRow.Hidden = False
ActiveWorkbook.Sheets("Tasks").Rows("30:48").EntireRow.Hidden = True

View 1 Replies View Related

Elseif Statement In Vba: If The Selected Cell Falls Between 1/01/06 And 31/01/06 Then Jan Would Be Selected

Oct 10, 2006

Basically it is a if statement saying that if the selected cell falls between 1/01/06 and 31/01/06 then Jan would be selected. The end part is not a problem; I’m just not sure how to write the one line of code that would test if the cell falls between the two dates. I attemped to create it as shown in the code attached below but wasn't successful. I used an else if statement to test the other 11 months.

Sub test()
Dim SelectDate As Range
Set SelectDate = Range("SelectedDate")
If selectedDate >= 1 / 1 / 2006 And selectedDate <= 31 / 1 / 2006 Then
ActiveSheet. PivotTables("PivotTable1").PivotFields("PnLDate").CurrentPage = _
"Jan"
ElseIf selectedDate >= 1 / 2 / 2006 And selectedDate <= 28 / 2 / 2006 Then

ActiveSheet.PivotTables("PivotTable1").PivotFields("PnLDate").CurrentPage = _
"Feb"........................

View 4 Replies View Related

Copy Selected Rows & Insert As Many Times As Rows Selected

Feb 6, 2008

The following code inserts a row below the selected row, and copies the formula of the row above into it.

Dim Rw As Integer
Rw = ActiveCell.Row
Selection.Insert Shift:=xlDown
Rows("" & Rw - 1 & ":" & Rw - 1 & "").Copy
Rows("" & Rw & ":" & Rw & "").Paste

However, I need to alter this to work for inserting more than one row at a time. ie. the user selects 'x' number of rows and 'x' rows are inserted below (in the same way 'Insert Row' works in Excel) and the row above the selection is copied down.

View 2 Replies View Related

Find Words - Deleting The Words - And Deleting Some Info After The Words.

Jun 23, 2006

I am trying to find certain words in a column and delete the word and characters following. For example, Say I have a column of info as seen below. This is a test of me. I am just experimenting with this stuff. Deleted (6/15/01) Let me know what you think. I am not sure about it all, but I guess I will figure it out. riviledge1 (01/05/06) Now let's see what happens when I try to test it.

I want to find all the "Priviledge1 (01/05/06)" and replace with nothing. Please note, the date will change with each record, so I need to figure out how to tell Excel to find "Priviledge1", delete it and the date behind it. So I want to delete "Priviledge1" and the next 11 characters including the space.

View 3 Replies View Related

Deleting A Tab

Apr 6, 2008

i have created a user from called "delete"

from this the plan is that you will be able to select the name of the tab that you wish to delete from a drop down list (which will contain all the tab names) and click on a command button and this will then delete it

View 9 Replies View Related

Deleting A Row Using VBA

Dec 28, 2009

I am in need of code that will match a variable, "TheName", to the values in a range named "Phases". If a match is made then I want to delete the entire row which the value is matched in.

example:

PHASES
cat
dog
pig

My variable, "TheName" = Cat

I want the code search only the range "Phases" and delete the entire row in which the variable "TheName" is found. so in this case it would delete the entire row in which the value of "cat" was matched.

View 9 Replies View Related

Deleting Row/cell

Mar 31, 2007

In Excel 2007, when I delete a row/cell, text is associated with deleting row/cell but some lines, polygon ... can not associate with deleting row/cell . So the lines, polygon ... in mistake location.

View 12 Replies View Related

Deleting After 9 Numbers

Jan 8, 2009

I have data in a column that has numbers letters and characters in, all that I require is the first 9 numbers (these are always the first 9 characters), any idea how this can be achieved.

View 5 Replies View Related

Deleting Duplicates

May 7, 2009

I m writing a formula that will highlight duplicates. I want to use the supplier code (column D) as the search criteria. can the formula identify these duplicates by entering the word 'duplicate' in column L.

View 3 Replies View Related

Deleting Brackets

Nov 10, 2009

I have a long list of names with their locations in brackets. What formula should i use to delete the brackets and their contents only?

View 3 Replies View Related

Not Deleting Any Cells

Aug 15, 2007

The loop cycles through my sheet correctly but wont delete any cells.

View 10 Replies View Related

Deleting Sheets If It's Name

Jul 9, 2008

Checks if there is a sheet name and if there is a sheet of that name then it is deleted.

the sheet name is a number entered through an inputbox and "Average"

View 10 Replies View Related

Deleting Row After Copied

Nov 7, 2008

Just finished amending a piece of code to enable me to search for an agents name in a list of files. This is then copied to a new worksheet (named by the name entered in the search). What I need is to cut(or delete) the row from the original sheet (sheet 1 in this case) thus leaving me the remaining list of files.
Below is how the code is setup at the moment....(just copies the row)

View 12 Replies View Related

Deleting Columns

Dec 26, 2008

Deleting Columns. I've got 2 codes here,

This:

View 3 Replies View Related

Deleting The First 8 Characters In Vba

Jan 2, 2009

I have a column that has all the digits in the phone number. What I would like to do is remove the first 8 characters example 111-222-3333. I want to remove all the ones dash twos and dash. Can someone help me please ?

View 7 Replies View Related

Keep The Value Of Sum After Deleting Integer

Mar 30, 2009

i need is a script that will add two boxes together to get a sum in a third box, but where it is tricky for me is that i need the third box to retain the summed value even when either of the first two box values are deleted.

For example, say i have box A1=10, B1=40, and C1= SUM of A1 & B1 (so C1=50). Easy enough, but where im lost is that i want to be able to delete the value of either A1 or B1 and then have C1 still = 50, so then i can input another value into either A1 or B1 to continue to add to C1.

View 6 Replies View Related

Deleting People's Second Name

Sep 16, 2009

In column G of my excel 2003 worksheet named: Data, I have a list of people's first names. These names were extracted from an external database.

Some of the first names actually contain peoples second names or partner's names.

Example:

John & Jill
James and Sue
Kerrie-Anne

Joanna Lyn

I need a macro to please delete people's second name.

So in the example above I need to keep all names that are joined by: & or and or - (such as John & Jill, James and Sue, Kerrie-Anne).

Also, in the example above I need to delete all names that are joined by a <space> (such as Joanna Lyn).

View 11 Replies View Related

VBA And Deleting Rows

Sep 21, 2009

I have an excel spreadsheet that contains about 1000 rows and about 25 columns. The file contains employee information, name, id, cost center, department, title, FTE...etc. Column E contains the cost center which is a 7 digit number (i.e. 8001234). Within the 1000 rows of data there somewhere to 70 cost centers. I would like to delete all rows where a cost center does not match a list of 13 cost centers. I'm thinking I need some kind of array where I type in the 13 cost centers in the code, but I'm unsure of the syntax within VBA.

Also, the second step of the code I'm looking for is to delete all columns except for Column B, E, J and L. Those, by the way are Name, Cost Center, Job Title and FTE.

View 2 Replies View Related

Deleting Value From A Cell

Oct 8, 2008

I am using this code to populate column J with a date when yes is selected in colum I.

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Column = Columns("I").Column Then
If .Value = "Yes" And IsEmpty(.Offset(, 1)) Then .Offset(, 1) = Date
End If
End With
End Sub

However i also want any value entered in J to be deleted when No is selected.

View 2 Replies View Related

Deleting Rows That Contain Particular Value

Oct 26, 2011

I want to delete all rows in the column of the ActiveCell when the ActiveCell.value < 0.01. Could you tell me why the code below doesn't work? It deletes the right rows but keeps looping without stopping

Sub DeleteZeros()
Dim Col As Long
Dim StopRow As Long
Col = ActiveCell.Column
StopRow = Cells(Rows.Count, Col).End(xlUp).Row

Range("A1").Select

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

View 6 Replies View Related

Deleting Last 5 Characters?

May 15, 2012

Im trying to write a macro to delete the last 5 characters of a cell,

Its the whole column to which i need to apply this to

View 8 Replies View Related

Deleting Shapes In VBA

Sep 18, 2012

I have some shapes on a worksheet that need deleting on change of a combo box. Unfortunately I'm unable to use the below code as not all the shapes need deleting, just the ones that are named in a table on another worksheet.

For Each s In ActiveSheet.Shapes
s.Delete
Next s

Also not all the shapes named in the table will be on the worksheet as this depends on what is selected from the combo box.

View 2 Replies View Related

Deleting Rows

Apr 25, 2007

I have a macro that deletes rows. For some reason, the macro bombs out when the selection seems to be too big. Why is that?

deleterow_min = Sheets("Sheet1").Cells(1, 6)
deleterow_max = Sheets("Sheet1").Cells(1, 7)

Rows(deleterow_min & ":" & deleterow_max).Select
Selection.Delete Shift:=xlUp

View 9 Replies View Related

VBA :: Deleting Blank Row

May 5, 2007

Public Sub Delete_Blank_PO()
Dim iLastRow As Long
Dim Rng As Range
Dim r As Long
Dim x&
Sheets("ZF17.4").Activate
For x = Cells(Rows.Count, 2).End(xlUp).Row To 6 Step -1 '***set coumn 6 as range
With Cells(x, 6)
Select Case "" '.Value

View 9 Replies View Related

Deleting The Entire Row In VBA

Dec 24, 2007

I have a spreadsheet with thounsands of rows. Some of the rows I'd like to delete because thier values are below 5%. I wrote a VBA code, which primary function is to look for a cell and delete the row if the value is less than or equal to 5%. The code looks fine but I get an "Infinite Loop" anytime the first row value is not true. Below is the code,

-jungleman1

Sub Delete_Zero_Factors()

Dim i As Integer
Dim CUSIP As String

Sheets("Report").Select

Range("B5").Select
i = 0

While Not (IsEmpty(ActiveCell.Offset(i, 0).Value))
CUSIP = ActiveCell.Offset(i, 0).Value

Do While (ActiveCell.Offset(i, 1).Value

View 9 Replies View Related

Deleting Row If A Certain Condition Is Met

Feb 29, 2008

I have a list of data (this list is variable) and I want to delete the rows that have the word Revaluation in column L.

I tried the following but it did not work

Sub Delete()

Dim Lastrow As Long, i As Long
Lastrow = Cells(Rows.Count, "L").End(xlUp).Row
For i = Lastrow To 1 Step -1
If Range("L" & i).Value = Revaluation Then Rows(i).EntireRow.Delete
Next i
End Sub

View 9 Replies View Related







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