Macro Is Deleting My Entire Sheet

Nov 15, 2006

Sub Delete()
Dim x As Long
For x = 28 To 8 Step -1
If Range("b" & x) = "" Then _
Range("b" & x).EntireRow.Delete
Next x
End Sub

View 9 Replies


ADVERTISEMENT

Keep Macro From Clear Entire Sheet

Feb 25, 2014

This macro clears all the contents of each sheet to which it refers, however, after putting it to use I find that I need it to clear only columns A-G starting at row 10. I am not sure how to modify it to do so though. Actually it would be even better if it would only clear columns A, B, C, E, F, and G.

View 14 Replies View Related

VBA Macro To Copy Entire Row To Another Sheet

Feb 20, 2010

I have written Macro to copy every row in "sheet1" 24 times into new sheet called "NewSheet". but it keep giving me error message. Actually, I don't know why. Can any one please help.

here is my macro

Sub CopyRowsBook2()

Worksheets.Add().Name = "NewSheet"
Sheets("Sheet1").Select
' Find the last row of data
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row

' Loop through each row
For x = 2 To FinalRow
Worksheets("sheet1").Cells(x, 1).Select
ActiveCell.EntireRow.Select
Selection.Copy
' Loop to copy every row 24 times
For i = 1 To 24

Sheets("NewSheet").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(NextRow, 1).Select
ActiveSheet.Paste

Next i

Sheets("Sheet1").Select


Next x
End Sub

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 An Entire Column

May 2, 2006

Need the code for deleting multiple columns simultaneously in an excel depending on some search criteria.Suppose I want to delete the columns whose names are "Roll No" ,"Age" & "Class"

View 2 Replies View Related

Trying To Run A Macro To Sort And Remove Duplicates From Entire Sheet

Aug 31, 2009

Currently use this macro (see below) but occasionally I have more rows than 842. I could increase to 10000 and this would work but looking for a more automated macro that will automatically remove duplicates from all rows i.e. a macro that works out all rows.

Sub copyTab()
Cells.Select
Selection.Copy
Sheets("filtered_data").Select
Range("A1").Select
ActiveSheet.Paste
Columns("A:A").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$1:$J$842").RemoveDuplicates Columns:=1, Header:=xlYes
End Sub

View 4 Replies View Related

Macro For Deleting First Three Rows In All Sheets Except 1st Sheet

Apr 1, 2014

I have a excel file with more than 10 sheets and every sheet has a title on its first three rows.

I want to delete first three rows in all sheets except parent sheet .

View 4 Replies View Related

Macro Deleting Values On Wrong Sheet

Jun 6, 2009

The below code is supposed to delete data on the last sheet of the workbook HeadsetOutTimeMay.xls however for some reason it is deleting the data on HeadsetOutTime.xls What am I doing wrong?

View 8 Replies View Related

Deleting Entire Row That Has Cells With Certain Strings?

Mar 16, 2013

I am trying to delete entire row that has certain text, let say "hi". I was able to delete cells with exact word "hi", but was not able to delete cells that have texts other than "hi". ex) "hi myname." Below is my vba code, and I keep getting run-time error and cannot execute the code.

VB:
Sub HiDelete()
Dim srchRng As Range
Set srchRng = ActiveSheet.Range("g:g")
For i = srchRng.Rows.Count To 1 Step -1
If worksheefunction.Search("hi", Cells(i, 7)) > 0 Then Rows(i).Delete
Next i
End Sub

View 3 Replies View Related

Deleting Entire Rows Containing A Specific Value

Aug 29, 2007

I've been tasked with developing a macro that will generate schedules. For background, we're taking a QuickBooks Customer file and exporting it to be picked up by the macro. I've got that part working, but now I need to delete various rows based on certain criteria.

The spreadsheet has a field for Job Status which we use to define whether an account is under contract (2 in QuickBooks), or some other status. Basically what I need to do is delete the entire row of data where JobStatus (Column R) is anything but 2.

View 9 Replies View Related

Deleting Entire Column - Statement Ignored

Apr 11, 2012

Working on some code that will find the Column Name "CL" and delete the entire column. Here is what I have so far...it does not give me a error when it compiles, but for some reason the statement in red is being ignored. I tried switching Range with Columns, but that did not work.

Private sub coldelete ()
Dim Rng2 as Range

shUCLR = sheets("Unit Cost").usedrange.rows.count
Set Rng2 = Sheets("Unit Cost").Range("A1:BF1")

For Each d In Rng2
If d = "CL" Then
colnum = d.Column
colletter = Left(Sheets("Unit Cost").Cells(1, colnum).Address(False, False), (colnum)

View 2 Replies View Related

VBA Deleting Entire Row When Certain Word Appears?

Dec 12, 2012

I currently have the following code that works great and deletes the row from my spreadsheet when the word "vacant" appears in column F.

Sub test()
Dim r As Range
With ActiveSheet[code]....

The problem is, "Vacant" also sometimes appears in column G. So, as this code is now it is finding the word "Vacant" in either column F or column G and then deleting the row.

How can I write the code so that it only deletes the row where "Vacant" appears in column F but ignores it when it is in column G?

View 3 Replies View Related

Macro - How To Remove Delete Prompt When Deleting A Sheet

Jul 22, 2013

I have a Macro which deletes a sheet called "Pre selection" with:

Sheets("Pre selection").Select
ActiveWindow.SelectedSheets.Delete

It asks me every time if I am sure and I have to click to continue. Is there any way to remove this prompt or set it to continue without my intervention?

View 3 Replies View Related

Deleting Entire Rows Once Filter Has Been Applied

Nov 24, 2011

I've got a report which is approx 40,000 rows long and I need to delete out alot of the info.

I need to delete out entire rows if column C contains a 0.

I've written a loop to do this but as theres so much data it take a long time to run.

Is there a smarter way to do this?

View 6 Replies View Related

Deleting Duplicate Cells (not Entire Rows)

Dec 17, 2007

I have a long list (over 1000 lines) of numbers, some of which are duplicated. Up to now I have been sorting them, adding in a simple check column to see if the number is a duplicate of the one below, and then manually deleting this cell.

Is there a better way to do this using VBA? The only way I have managed to find is by deleting the entire row, but I cannot do this as I have additional data to the right that I need to keep.

I also cannot install any add-ons as this on a work computer.

View 9 Replies View Related

Deleting Entire Customer Entry If One Cell Is Blank?

Dec 24, 2008

I have a large database of customers. I would like to edit this database so that it only lists those customers that have an email address listed in that particular column. I can then save that as a separate list to upload to my marketing campaign.

Is there an easier way than just deleting entire rows at a time? About a 2,000 name list with maybe 30% having email addresses.

View 2 Replies View Related

Deleting Entire Columns Based On Cell Formatting

May 15, 2009

I'm trying to come up with a macro that can delete an entire column based on formatting of the cells. Basically what I have is a range of cells, and if all cells in a particular column have no fill color, then delete the entire column.

View 9 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

Print A Border Around The Entire Sheet No Matter How Many Rows Are In The Sheet

Aug 28, 2008

I have a sheet that I want to have a double line border around the outside. Thats easy if there were a set number of rows but in my sheet the number of rows will depend on the size of the rows because of the different amount of information in each cell. So how do I make it print a border around the entire sheet no matter how many rows are in the sheet??

View 9 Replies View Related

Deleting Rows From Sheet 1 When Table On Sheet 2 Does Not Have Data Anymore

Jul 3, 2014

Currently, Im running a button macro. When this button is clicked, the table from "315 Employee Data" will copy the names from column C to "315" sheet B12 onwards.

Now, what i want is when I update the employee data on "315 employee data" sheet, I want "315" sheet to automatically match the names from "315 employee data", delete and add names when I add or remove employees from the column the next time i click on that button again.

After the above is achieved, when i add new employees,run the macro and it displays the updated list of names, I want "315" sheet column A to do automatic numbering.

I have attached the file for your reference.samplesample.xlsm

View 2 Replies View Related

Copying/Deleting Rows From Sheet To Sheet

Aug 2, 2007

what I need, but can't seem to string anything together for the final product. What I want to do is search one sheet, in column BQ, for the word Complete. If a cell has that word in it, I want to copy that row, paste it into another sheet, and than go back and delete that row, and continue the search until all rows have been searched. Is there a simple way to do this?

I was thinking of an auto filter, but I'm not sure it'd work how I want it based off of what I've read.

View 9 Replies View Related

Import Entire Row From Sheet 1

Feb 1, 2013

I have a sheet (1) of data, a1: e200. In another sheet (2) I want to search for values ​​in column B in sheet (1). I want to import the entire row where the value is. The imported row should always go to ex a10:e10 in sheet(2). Because, in sheet (3) I have this letter who gets data from sheet (2) row a10:d10.

How to do this? I can't get it done without copy/paste.,.

View 6 Replies View Related

Cut Entire Rows To Another Sheet

Jan 8, 2009

I have a list of projects in several rows and at the column "K" is the status of the project, according to the status of the projects if the status is completed I want cut this entire rows and paste to another sheet calls Projects_Completed by using a macro

View 9 Replies View Related

Copy Entire Row To Next Sheet

Mar 2, 2009

with VBA on below mentioned data names in column A on that some names are repeated . That repeated names with amount & doc number should be cuted & and paste in the next sheet ie sheet2 help with VBA ....

View 9 Replies View Related

Entire Sheet Into A Variable

Feb 20, 2007

I need a command to copy an entire sheet into some variable, in order to paste that variable in the same sheet later, if necessary (classical undo functionality).

Something like:

Private Sub CopySheet()

w = Worksheets("test")
...
...
Worksheets("test") = w 'UNDO if necessary

End Sub

View 9 Replies View Related

Saving Sheet But Not The Entire Workbook?

Mar 14, 2013

All I want to do is save a copy of one sheet called "Patient Stock Form", change the name to "Patient Order", and put it into an email. But my code is putting the entire workbook into the email. Here's the code:

VB:
Sub EMAILFORM()
Dim oApp As Object ' Outlook.Application
Dim oEmail As Object ' MailItem

[Code]....

View 8 Replies View Related

Formula That Paste Entire Row From One Sheet To Another

Apr 18, 2014

I need a formula that finds each instance in shee1 column "L" where the row contains the text "1st" in them. If that criteria is met then the entire row from sheet1 is pasted into sheet2. I would like the rows pasted in order of appearance.

Example:
"L52" in sheet1 contains the text "1st" so the entire row 52 from column [A to COX] would be entered in sheet2 in A3 and the next instance where "1st" appears would be entered in in sheet2 in A4.

Please see the attached spreadsheet for a better explanation of what I'm trying to accomplish.

first_instance.xlsb‎

View 3 Replies View Related

Autofilter Will Not Always Select Entire Sheet

Sep 4, 2009

I have a workbook that uses Autofilter.
Column A has data. Column B is hidden, has no data, and is empty.
Colmn C has data, on through the rest of the sheet (to Column AB).

Why column B has no data is unimportant for now. It, however, must maintain its existance and cannot be deleted.

When I select the autofilter sort button on column A, it selects only that column, and not the rest of the sheet. Data is subsequently scrambled.

When I unhide the empty column B and select the sort button on column B, it selects the entire sheet. Data remains intact.

When I select the sort button on column C, it selects the rest of the sheet, but not column A (with data), or B (with no data). Data is subsequently scrambled.

View 5 Replies View Related

If Cell = X, Then Copy Entire Row Into A New Sheet

Apr 20, 2009

I have a report that I use everyweek and split up into various sheets according to the criteria.

So if any cell in column C contains "Apple", then I want it copied into a new s/s (with the headers). I basically have to do a number of iterations on this, can someone assist please? The main problem I invisage is asking Excel to copy the row into the new sheet underneath the last one.

View 14 Replies View Related

Cut Entire Row To Another Sheet Based On Cell Value

Jan 29, 2010

I have a range of data in Sheet1- if in column D the cell contains the word "Everyday" I need the entire row to be cut and pasted to Sheet2. Does anyone know of a way in which a macro could do this? I would need the entire row to be cut from Sheet1 and pasted into Sheet2.

View 3 Replies View Related







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