Delete non blank columns - excel

I am working report where a column has few hold codes like HN,HC,HO,etc.. How to delete whole hold codes and keep only blanks in VBA macros?

Related

Combine Excel columns and filter out blanks

I am trying to combine several excel columns and separate the data with a comma. Some cells are blank so I want to avoid adding unnecessary commas. How do I add a conditional that says "if the cell is blank don't attempt to add the data and another comma"? The output I am looking for is on the right. I am trying to perform this on a large dataset and the number of columns for each row is variable. The only time a blank cell will be encountered is at the end of the row.
I have tried basic concatenate and am using excel 2010.
just copy and paste the following formula in your result column.
=IF(ISBLANK(A1),"", CONCATENATE(A1,IF(ISBLANK(B1),"", CONCATENATE(CONCATENATE(",",B1),IF(ISBLANK(C1),"", CONCATENATE(CONCATENATE(",",C1),IF(ISBLANK(D1),"", CONCATENATE(",",D1))))))))
This works fine for your first 4 columns (atleast in Excel 2016:), however this is not a recommended solution as you have mentioned that you're working with a large dataset, but might help you!

VBA perform an autofilter and then delete data from specific columns

I am performing an autofilter in vba and would subsequently like to delete visible data from the last columns in the sheet (in code LastRWMC and LastCWMC are the last row and column respectively). however the code attached wants to delete the entire row, which I do not want to do. I have tried selecting which selects the correct data but when I go to delete it deletes the entire row.
I want to delete from column twenty onwards.
ws5.Range(ws5.Cells(2,20),ws5.Cells(LastRWMC,LastCWMC)).SpecialCells(xlCellTypeVisile).delete

Applying excel formula for an entire column

I have an excel sheet with Time(e.g 4:00:07) and an integer (25). I have inserted an additional column between the two.I want to extract the minute information from the Time column and apply it to the newly inserted column.
I am using the excel formula =TEXT(A:A,"hh:mm") which works fine for a single cell/column, but I am not able apply it for the entire column. How do I do this?

Automatically insert a new row with merged cells above a cell with formula

I am creating a spreadsheet for use inside our court system. I would like the sheet to automatically expand as it is being filled in. There is no way to pre-determine how many rows will be used. I want new rows to be automatically added when the user fills in all the pre designated rows. That I can do easily.
I already have the VBA automatically creates the new row where I need it.
My problem is the new rows are not formatted the way I need them to be. In my worksheet, in the rows that are added, columns B,C & D need to be merged and columns E & F need to be merged.
How can I add that function to my existing VBA code?
By converting the range into a list, most of this is automatically done. Zero programming. Just read the manual :-)
And by the way, avoid merged cells at any price ! Same effect can be achieved by formatting (center across selection), and avoids plenty of annoyances for range selection, inserting columns, autofill, etc...

Excel 2007 VBA - How to delete all row in a spreadsheet excluding the rows in one column

How can i delete/clear all rows except for one column using excel VBA?
Additional info: i have one column with formulas computing a certain thing using values from other columns which i am importing from access database.
Any work around if i dont want to delete the formula in the one column but want to delete everything else?
Use SpecialCells to return only Cells of certain types
To delete all constants use:
ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants).ClearContents

Resources