#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 51
Default Save details

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Save details

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 51
Default Save details

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Freezing Details Teedie Excel Discussion (Misc queries) 6 July 3rd 08 06:19 PM
Can I auto save details from one cell...... dim Excel Discussion (Misc queries) 2 October 10th 07 12:03 PM
I want to choose a name then other details will appear on other ce fLy Excel Discussion (Misc queries) 5 January 8th 07 07:01 AM
Can I get excel to auto save details from a cell into the doc nam. excelnewbie Excel Worksheet Functions 3 September 16th 05 07:35 AM
details of month srinivasan Excel Worksheet Functions 9 July 15th 05 08:42 AM


All times are GMT +1. The time now is 11:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"