I am trying to create a macro that copies the active worksheet to a new worksheet and paste values only. For instance, Sheet1 is the active sheet. I want to make Sheet1(2) with values only. Additionally, I evaluate each row of the Sheet1(2) to look for a value of X in a cell in each row. If there is an X, then the row is deleted.
My attached code kinda works. It copies Sheet1 to Sheet1(2) and deletes all of the rows with an X in a particular cell, the problem is it is a duplicate copy with the formulas. I just want it to copy and paste the values (so it would be a static worksheet of values only, no formulas).
I'm not the best at programming so any suggestions I really appreciate.
My attached code kinda works. It copies Sheet1 to Sheet1(2) and deletes all of the rows with an X in a particular cell, the problem is it is a duplicate copy with the formulas. I just want it to copy and paste the values (so it would be a static worksheet of values only, no formulas).
I'm not the best at programming so any suggestions I really appreciate.
Code:
Sub SPACER_Button4_Click() ' Compile Button to Generate Quote ' 'variables definitions ActiveSheetValue = ActiveSheet.Name ' 'This section creates a copy of the active worksheet and names it with the next corresponding number. Sheets(ActiveSheetValue).Copy After:=Sheets(ActiveSheetValue) 'This section should look for X value in each row, column 4. If value equals X, it deletes the row on the copied sheet Dim i As Integer i = 26 Do Until i > 300 If ActiveSheet.Cells(i, 11).Value = "X" Then Rows(i).Delete Skip = True End If ' If Skip = False Then i = i + 1 End If ' Skip = False Loop 'This part hides columns on Right K thru R of new copied sheet Sheets(ActiveSheet.Name).Range("K:R").EntireColumn.Hidden = True ' End Sub
Comment