Macro- With Deleting Only Visible Fields
Mar 24, 2009
I will paste data into columns A-H, I have headers in rows, 1,2 and 3. I have formulas in a few cells in row 2. After inputting my data on the sheet etc I copy all the formulas from row 2 and paste in teh relevant columns, I then select my autofilter and my selection (in this case #N/A), i then choose all visable cells (Alt and ;)and delete them. The problem is I do not want to delete rows 1,2 or 3 but all other rows (i.e. just the selected N/A rows). Can anyone help on how to do this?
Once i have figured this out I will then continue the macro to select 'all' on the filter and do the same to a few other columns.
So far I have this;
Sub Macro6()
'
' Macro6 Macro
' Macro recorded 24/03/2009 by Richard Tydeman
'
'
Selection.Copy
Range("I4:I5000").Select
ActiveSheet.Paste
Range("J2").Select
Application.CutCopyMode = False
Selection.Copy
I think the extra bit of code needs to go in after selecting visible cells - something that says exclude row1,2 and 3 but im not sure.
View 9 Replies
ADVERTISEMENT
Nov 6, 2012
I have an issue with trying to write a macro to apply a filter and then delete all lines.
Within the macro I copy and paste one sheet to a new one, and Paste Special Values over all formulas, leaving me with a column that has some figures and some "#N/A".
i.e.
13.75
12.00
#N/A
14.00
So I need to do something in the macro that then applies a filter on this column and deletes off all the #n/a results.
This table has a number of columns not just this one so it is the full rows that need removing.
I see on other posts that using a range.specialcells clause could work, but i'm not too sure exactly on how to apply this.
View 1 Replies
View Related
Jun 6, 2013
I'm working through a filter macro to delete unecessary rows of data from my dataset.
- I have a Dynamic Range for my dataset called "CanadaData"
- I'm trying to delete rows from the 5th column of my dataset for cells containing "DIRECTSHIP"
The macro filters the range fine, but when if comes to deleting the row, the macro stops.
Sub CanadaWarehouseFilter()
x = Range("E" & Rows.Count).End(xlUp).Row
If Application.WorksheetFunction.CountIf(Range("E22:E" & x), "DIRECTSHIP") > 0 Then
With Range("CanadaData")
[Code] ......
View 2 Replies
View Related
Jun 19, 2013
I am trying to create a list from where all the fields are visible and you can just click on them.
It is not a drop down list. It's a list where all possibilities are visible and you can just click on them.
It is probably not even done with a list or with validation data.
View 1 Replies
View Related
Aug 3, 2007
I searched for a solution to my problem, but couldn't find one that matched. Is there a formula that counts the number of visible fields. The data in my sheet is non-numeric. I tried COUNT, but it didn't limit the number when I used autofilter, so that formula doesn't seem to work.
View 3 Replies
View Related
Jul 1, 2006
I have a column of about 20 different usernames, and I need only about 8 of the names.
I can sort the list and delete manually, but it is very tedious.
Is there a way I can make the Column search for certain names and delete everything (including the row) that's not the name I want?
View 3 Replies
View Related
Apr 30, 2014
I have a data in which I have inserted a table with headers.
I then filter the type of data I want removed from the table using the drop down
Then goto special, visible cells only, press delete.
Now, the data is gone, but when I select all again to pull up the entire table, the data is gone, but rows are still there. So now I have tons of empty rows in between the rows of needed data. Any way of removing the rows in between as well as the data?
View 4 Replies
View Related
Dec 10, 2009
I have 3 columns of data that are being copied from a .csv file. The data is pasted into Columns B, C, & D. Columns C and D are hidden. So that the user does not have to unhide the columns in order to delete the data, I would like to make it so that when the data in column B is deleted, the data in columns C and D is also deleted.
View 14 Replies
View Related
Jul 16, 2007
I have written two VBA programs around the same time. Both run on open and pull external data and create graphs. My problem is that I want the end user to be able to run the report multiple times by choosing the name of the macro from the Excel macro menu (i.e. Tools>Macro>Macros) but only one of the workbook macros shows up on the menu. why the other macro is not visible on this menu???
View 2 Replies
View Related
Apr 22, 2009
Need to correct code to resize all visible rows on a sheet based only on the text in the visible columns. I have tried the below code but when it resizes it is using the largest amount of text in the rows including that in the hidden columns.
View 3 Replies
View Related
Apr 10, 2014
I have two slicers, say slicer 'F' that slices on fields 'x', 'y' and 'z' and slicer 'E' that slices on fields 'a', 'b', 'c'.
I select these values by using a very simple macro. For instance to select z in slicer "F", I have the following code:
With ActiveWorkbook.SlicerCaches("F")
.SlicerItems("x").Selected = False
.SlicerItems("y").Selected = False
.SlicerItems("z").Selected = True
End With
However, I want the selected fields to have more flexibility than which is possibly by coding them in VBA. Ideally, I would want to write the selected fields in a cell in Excel (also if there are more of them!), then let the macro retrieve these fields and use them to apply to the slicer. So I write in a cell slice on X and Z, the macro picks this up and performs this operation.
Is this possible?
View 1 Replies
View Related
Mar 8, 2014
I have excel sheet with filtered columns. I will do the filtering manually and after selecting a filter, I want the visible data on the sheet to be saved as PDF file.
Please note that I dont want any range to be saved as PDF but visible data because as the filter changes, so as the data will be either less or more.
View 7 Replies
View Related
Apr 9, 2014
I need a simple macro to use for conditional autofill of cells below the active cell (to the end of the sheet) with the text that is being entered in the active cell.
DESCRIPTION: I have two columns of data, the first (call it Col1), has a word number which is unique to each specific word in a foreign language, every cell in this column has a number in it from 1 to 30000. Each number reoccurs many times in cells over the length of this column.
The other column (call it Col2) is blank. As I type words in english in each cell of this column, I need the macro to autofill the text that I have just entered, into every cell in Col2 where it's Col1 number is a match with the Col1 number where I am typing.
For example, in one row, Col1 has the number "21" and I type in Col2 the word "run". I need the macro to find every row where the number 21 is found in Col1 and automatically enter "run" into Col2 at that location.
The macro must only autofill cells which have no data in them. Preferably from that cell down, although if that is not possible, all cells would work seeing we are only replacing blank cells with data.
View 5 Replies
View Related
Aug 29, 2007
I want to print out, for a range of 'Page Fields', from a Pivot table automatically.
The Macro must be able to:
Automatically go through and select the 'Page Fields' in the pivot table
Select the print area range automatically, which will change each time the pivot is refreshed/reselected.
Set the print area to fit the page for each category selected in the pivot table
Finally print.
Can't find code for this anywhere, but i must admit got fed up with looking
View 3 Replies
View Related
Apr 13, 2008
I'm working with a large master list of part numbers, and matching data to these numbers from a varying data table via vlookup. I have to vlookup to the actual part number, (13,000 numbers), then subtotal the data based on the "Rollup" part number. (eg: Two different old PNs have now "rolled up" into a single part number. I am pulling sales data from all of the old numbers, and subtotaling the sales to the new number.) Too much information.
Here's my issue. After subtotaling on the rollup number, I want to copy and paste ONLY the rollup numbers and associated data to a different sheet. This should be easily accomplished by going to level 2 of the subtotals page, hiding all the old PNs and their data, selecting the remaining visible cells, then "Go To", "Special", "Visible cells". Normally, you could copy only the visible cells, and paste them wherever you want. But because of the total length of the subtotaled worksheet, (nearly 25,000 rows), I get the error message, "Micrsoft Excel cannot create or use the data range reference because it is too complex."
You can overcome this by selecting smaller ranges of data, and copying and pasting a little at a time, but since the "visible rows" will vary, I can't figure a way to incorporate this into a macro. I've tried setting specific ranges in the macro, and copying and pasting fewer cell at a time, but if the range named in the macro is a hidden cell, the macro won't select any of them.
Here's an example of what I've got so far. I realize it's not the most efficient code, but I'm working with limited knowledge and ability.
View 8 Replies
View Related
Apr 24, 2008
I wrote a macro for a pivot table.
Range("A1").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Export!R1C1:R3000C53").CreatePivotTable TableDestination:="", TableName:= _
"PivotTable4", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _
"PivotTable4").PivotFields("Reference"), "Count of Reference", xlCount
With ActiveSheet.PivotTables("PivotTable4").PivotFields("ACN received date")
.Orientation = xlRowField
.Position = 1
End With
What i want to know is if there is a code line to test if "Non Processed" value exists in column "Status" and then hide the value.
Now, if the macro does not find one value just gives me error.
View 7 Replies
View Related
Jun 23, 2009
how to make this recorded macro work with more than the sheet it was recorded on. I need to work with the visible selections. But I'm having all kinds of problems trying to pick just the visible cells. Not having any luck with this project. I tried to included a test book but It keeps giving me an error.
View 4 Replies
View Related
Jun 22, 2007
I need a macro that can change the text in Field 46 from Criteria1 to something else, ie from "To be capped" to "Capitalised". This is my current
Selection. AutoFilter Field:=39, Criteria1:="OPEN" 'STATUS
Selection.AutoFilter Field:=46, Criteria1:="To be capped" 'TYPE
Range("AT1").Select
how to change the text only on the selection found by AutoFilter?
View 4 Replies
View Related
Dec 4, 2012
- The macro should then try to find this data on the worksheet "Sheet2" in the same workbook. This data on Sheet2 is essentially a table with four columns "Number" (Col A), "Country" (Col B), "Consol" (Col C) and "Bypass" (Col D) but can have around 70k rows
- It should look for Number first, and if its not found, the macro should insert the message "Update OK" in cell A8 on Sheet1
- If it finds at least 1 row for the Number but the Country is the same for all the rows and it matches the value input for Country on Sheet1, then it insert the message "Multiple Records - Update OK" in cell A8 on Sheet1
- If it finds at least 1 row for the Number but the Country is the same for all the rows and it does not match the value input for Country on Sheet1, and if all Bypass fields in Sheet2 have "Y" but the Bypass field input on Sheet1 has "N", then put "Multiple Records - Update OK" in cell A8 on Sheet1
- If it finds at least 1 row for the Number but the Country is the same for all the rows and it does not match the value input for Country on Sheet1, and if all Bypass fields in Sheet2 have "N" but the Bypass field input on Sheet1 has "Y", then put "Multiple Records - Bypass - Do Not Update" in cell A8 on Sheet1
- If it finds at least 1 row for the Number but the Country is the same for all the rows that have a Bypass value of "N" and it does match the value input for Country on Sheet1 then put "Multiple Records - No Need to Update" in cell A8 on Sheet1
- If it finds at least 1 row for the Number but the Country is different for all the rows that have a Bypass value of "N", then put "Multiple Records - Refer" in cell A8 on Sheet1
[URL] ....
TestBook.xlsm
View 6 Replies
View Related
Jul 16, 2014
I am currently working on a workbook to have employees fill in data on what tasks they compelted for the day, and how long it took. There are 5 colums (for this purpose) Task, Description, Time, Required to complete, Completed. The tasks are predefined and listed out in each row. There is also a space for employees to select the date they are entering the data for.
I would like to have a macro that is linked to a submit button and when pressed populates this data into a database on another sheet. This database is split into two sheets (1 with time and one with tasks required/compelted). Each sheet has the list of tasks going down a cloum on the left, and dates along a row on the top. When the employee presses submit I would like this data to popuplate in the coresponding date and task fields and then reset the form on sheet 1 to all 0's.
View 1 Replies
View Related
Jul 1, 2014
I have many checkboxes (1 to 26) that I want visible or not, based on whether the cell states "n/a" (are in a column in a different worksheet). Rather than writing this code multiple times, I'm looking to condense the code.
[Code] .....
View 2 Replies
View Related
Feb 8, 2014
CountryHourDataTotalData
Austria - A10Sum of SeiA51CountryHourSum of SeiASum of SeiT
Sum of SeiT4.88Austria - A10514.88
1Sum of SeiA561562.83
[Code]....
left side pivot created in vb 6.0 & right side pivot table created manually in excel.
i want to generated pivot table using vb 6.0 same as right side pivot.
Set PRange = ws1.Range("R1:Y" & finalrow)
Set PTCache = wb.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=PRange)
Set PT = PTCache.CreatePivotTable(TableDestination:=ws2.Cells(1, 1),
[Code]....
View 2 Replies
View Related
Oct 27, 2013
I need to write a macro where i need to copy set of rows from few columns of an excel sheet to another set of columns in same sheet . My excel looks something like this...
Product
F1020
F1023
F1025
F1120
F1123
F1125
[code].....
Now when i filter this table for Product PR01 only rows 1,3,4 will be visible while the other rows remains hidden
I WANT TO COPY ROWS COMING UNDER COLUMNS
F1120
F1123
F1125
TO
F1020
F1023
F1025
when i use the code
Selection.SpecialCells(xlCellTypeVisible).Copy
i get to select ones those are visible but i am not sure how i can PASTE them to rows visible under column f1020 to f1025
Tried this in a frantic effort
Selection.SpecialCells(xlCellTypeVisible).PasteSpecial xlValues
But got an error for " multiple selection"
View 1 Replies
View Related
May 2, 2014
I am trying to write a macro that takes the value in cell B2 from a workbook called ""numbers" in a worksheet called "summary," and creates a new worksheet in a workbook called "filestransfer" that is named the same thing as the value in cell B2 from "numbers." That part is done.
View 2 Replies
View Related
Mar 19, 2009
I want to delete every second row, because I have data with 0.25m interval and I want 0.5m interval. Why I try the following it doesn't work?
View 2 Replies
View Related
May 8, 2012
I need a simple macro to delete all sheets in a workbook except one that is called "START"
View 9 Replies
View Related
Jul 25, 2012
I'm looking for a macro that will delete a row with a certain value (0.00) and the row below it.
View 9 Replies
View Related
Aug 23, 2012
So I have a macro that creates a monthly set of reports, but some of them only relate to period 5 onwards. I wanted the macro to check whether a folder exists for periods 1 to 4, and if so, delete the folder and all the files inside it. I've used the following...
Code:
If Period < 5 Then
If Dir("I:AcctsCentral EngineeringEngineering Reporting Pack2012-131 April 20122-2 Reports - 4+8 Reforecast") "" Then Kill "I:AcctsCentral EngineeringEngineering Reporting Pack2012-131 April 20122-2 Reports - 4+8 Reforecast[code]....
but the macro just skips straight through the secondary IF statements without stopping.
I know this works on deleting files, and presumed it did too for folders, but it doesn;t.
View 2 Replies
View Related
Oct 19, 2013
I'm trying to delete both rows of the same data not just one.
item
warehouse
location
PANT
7050
2
A1-05-89
PANT
5051
2
B1-19-19
SHIRT
7050
2
J1-08-67
SHIRT
7051
2
J1-08-67
What i need is if there is a same location delete both rows and i cant figure it out to get it to do both of them not just one row.
View 9 Replies
View Related
Jan 2, 2014
I have a problem with the following macro:
Code:
Sub CalcsDelete()
Dim count As Integer
count = 1
For count = 1 To 100
ActiveSheet.Shapes.Range(Array("Picture " & count)).Select
Selection.Delete
count = count + 1
Next count
End Sub
It should simply delete picture 1, picture 2, picture 3, picture 4, etc. The problem lies within the "Picture " & count part.
This is obviously the name of the picture, i.e. picture 1, picture 2, etc.
That's what I tried to accomplish with the for-loop, but I'm not sure how to increment the number of the picture by means of using a for-loop and having that be the new name for the picture.
View 6 Replies
View Related