I have a spreadsheet that essentially has two sets of data from two different years that I put into one spreadsheet to compare and line up by adding rows to either set of data. I have a macro already that compares the cells that I need and insert rows in order to line up the data, sometimes it misses something and a blank row is added into one of the data sets that shouldn't be there which then throws everything after it out of whack. So then I have to fix the alignment in the area, delete all the blank rows in the corresponding data set after the misalignment and re-run my macro hoping it doesn't mess up again.
So to speed up the blank row deleting part I was trying to make a macro to do this for me. For example, I have data from 2014 in columns A
through DC
and 2010 data from DE
to EG
. I was trying to create another macro that would allow me to select a range of cells such as DE69:EG69
and it would go through each row in the same column range DE70:EG70
, DE71:EG71
etc and if all the cells in the range is blank, delete the range and shift the data up. Everything I try and find online just seems to delete the entire row rather than just the range I select.
I even tried a few ways that said it would work by selecting the range and running the macro but that didn't seem to work either.
So I tried to record the macro and then make the needed edits but I'm still having issues. I have tried using some code from my other macro to allow an input box to pop up and put the column letters where the begin and end of the data set is but so far its not working.
Option Explicit
Sub delee()
Dim colX As String
Dim colX2 As String
colX = UCase(InputBox("Enter the left column", "Compare Columns", "A"))
colX2 = UCase(InputBox("Enter the last column", "Compare Columns", "E"))
Range(colX & "1000000:" & colX2 & "1000000").Select
Selection.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp
End Sub