excel - How to Exclude a Specific Row from a Find Last Column Function -
I've created a spreadsheet that creates a list list, writing a macro, my intranets search page opens, the list in the row Enters the number (not shown in the image). And Excel gives information to the sheet as it enters the place (RIG), it creates a header in line 2. I made a second macro that removes inactive locations after this filter, I am leaving with a cleaner list, but I want to remove the header in line 2, which does not have any information at this time (such as column AH, AI, AJ and so on). I know that I can find the last used column of the worksheet, but whatever I want is the clear formatting, boundary and line 2 content, whenever the row 3 is empty till the end.
Is there a way to adjust this to exclude line 2 from the search?
Set the final integer like LastColumn LastColumn = Cells.Find (What: = "*", after: = [A1], _ SearchOrder: = xlByColumns, _SearchDirection: = Xl Pre). Column chamber (2, last column). Select ActiveCell.Offset (0,1) if not ActiveCell = "" then ActiveCell.EntireColumn.Delete (xlToLeft) DoEvents Else Exit Do End Loop
Last Code Student Response Thanksgiving After Joining Gary! !!
Find the last used column under the heading line, dial wf as worksheet functions as set range in the form of dim n wf = Application. WorksheetFunction Cells (1, 1) .EntireRow.Hidden = True Cells (2, 1) .EntireRow.Hidden = True = N = For Columns Step 1 from RCL = Room (1, n). The inserted column if wf.Subtotal (103, rCol) & gt; 0 Then exit the end if the next loop cells (1, 1). Interval Hidden = Wrong Cell (2, 1) .EntireRow.Hidden = False 'Trim header row used only in columns (2, n). Select Active Select Offset (0, 1). Select if it is not active = "" then the ActiveCell.EntireColumn.Delete (xlToLeft) DoEvents end the other if the loop
Just exclude the line from the exam:
sub searchlight column () Dim Badro as a long time, as a worksheet function range, I Long Bad = 7 i = 103 set wf = Application.WorksheetFunction Cells (BadRow, 1) .EntireRow.Hidden = true for N = Column.Count 1 Step to 1 set rCol = Cells (1, N) .EntireColumn if wf.Subtotal ( I, rCol) & gt; 0 then MsgBox is "the last used column:" & amp; En Cells (Badro, 1) .EntireRow.Hidden = False Exit Sub End If Next N Cells (Baddero, 1) .EntireRow.Hidden = False End Sub
Comments
Post a Comment