Microsoft Office Tutorials and References
In Depth Information
Comparing Columns Using Various Criteria
Do¶
On Error Resume Next¶
Open FilePath For Binary Lock Read Write As #File¶
Loop Until Err.Number = 0¶
'Loop through all the records in the file¶
Do While Not EOF(File)¶
'Get the record¶
Get #File, , Temp¶
'Is there information in it?¶
If Temp.Number > 0 Then NewTemp = Temp¶
Loop¶
'Increase the number by one¶
NewTemp.Number = NewTemp.Number + 1¶
'Save the date¶
NewTemp.DateStamp = Now()¶
'Return the number to cell B1¶
Range("B1").Value = NewTemp.Number¶
'Store the number in the text file¶
Put #File, , NewTemp¶
'Close the file¶
Close #File¶
End Sub¶
' * * * * *¶
Sub Auto_Open()¶
'Call the macro when the workbook opens¶
Autonumber¶
End Sub¶
Exl
Note: Change the FilePath variable to point to the folder and file in which the
counter is to be stored.
Comparing Columns Using Various Criteria
This example includes code to highlight the entries that appear in one list but
not in the other, to highlight the entries that are common to both lists, and to
generate a unique list from both.
Example file:
E029.xls
Scenario: Comparing data is one of the most common tasks
for which people use Excel. If two files with inventory part
numbers are received, you can find out which part numbers
are missing from one list, or which part numbers appear in
both lists, or create a list that contains all the part numbers
without repetition.
 
Search JabSto ::




Custom Search