Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have the following code:
Private Sub CommandButton99_Click() Dim iRow As Long Dim FirstRow As Long Dim LastRow As Long Dim wks As Worksheet For Each wks In Worksheets(Array("customers", "customers2")) With wks FirstRow = 2 'headers in row 1 LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For iRow = FirstRow To LastRow Step 1 If Application.CountIf(.Range("a1").EntireColumn, _ .Cells(iRow, "A").Value) 1 Then 'it's a duplicate .Rows(iRow).Delete End If Next iRow End With Next wks End Sub When I press command button1 it calls the code above. How can I insert to save the details as well? -- WH99 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
hi
do you mean save the query results? Activeworkbook.save regards FSt1 "WH99" wrote: I have the following code: Private Sub CommandButton99_Click() Dim iRow As Long Dim FirstRow As Long Dim LastRow As Long Dim wks As Worksheet For Each wks In Worksheets(Array("customers", "customers2")) With wks FirstRow = 2 'headers in row 1 LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For iRow = FirstRow To LastRow Step 1 If Application.CountIf(.Range("a1").EntireColumn, _ .Cells(iRow, "A").Value) 1 Then 'it's a duplicate .Rows(iRow).Delete End If Next iRow End With Next wks End Sub When I press command button1 it calls the code above. How can I insert to save the details as well? -- WH99 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Save the entries in the two worksheet.
I tried your code and seems to work. -- WH99 "FSt1" wrote: hi do you mean save the query results? Activeworkbook.save regards FSt1 "WH99" wrote: I have the following code: Private Sub CommandButton99_Click() Dim iRow As Long Dim FirstRow As Long Dim LastRow As Long Dim wks As Worksheet For Each wks In Worksheets(Array("customers", "customers2")) With wks FirstRow = 2 'headers in row 1 LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For iRow = FirstRow To LastRow Step 1 If Application.CountIf(.Range("a1").EntireColumn, _ .Cells(iRow, "A").Value) 1 Then 'it's a duplicate .Rows(iRow).Delete End If Next iRow End With Next wks End Sub When I press command button1 it calls the code above. How can I insert to save the details as well? -- WH99 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Freezing Details | Excel Discussion (Misc queries) | |||
Can I auto save details from one cell...... | Excel Discussion (Misc queries) | |||
I want to choose a name then other details will appear on other ce | Excel Discussion (Misc queries) | |||
Can I get excel to auto save details from a cell into the doc nam. | Excel Worksheet Functions | |||
details of month | Excel Worksheet Functions |