View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
tabašija tabašija is offline
external usenet poster
 
Posts: 5
Default macro for deleting cells trought column A

On Jan 28, 4:46*pm, "Rick Rothstein"
wrote:
Producing the list with deleted duplicate country names can be done with
thismacro(change the two Const statements and the single With statement to
reflect your actual data set up)...

Sub DeleteDuplicateCountryNames()
* Dim C As Range
* Dim X As Long
* Dim LastRow As Long
* Const DataStartRow As Long = 3
* Const DataColumn As String = "A"
* With Worksheets("Sheet6")
* * LastRow = .Cells(.Rows.Count, DataColumn).End(xlUp).Row
* * For X = LastRow To DataStartRow - 1 Step -1
* * * Set C = .Cells(X, DataColumn)
* * * If InStr(C.Offset(-1).Value, Left(C.Value, _
* * * * * * * * * InStrRev(C.Value, " "))) = 1 Then
* * * * C.Value = Mid(C.Value, InStrRev(C.Value, " ") + 1)
* * * End If
* * Next
* End With
End Sub

I would add the summation you want to the macro, but you didn't make clear
what you wanted summed up (the individual sums per country or the sum for
all the countries in the list). Which did you want? Also, where did you want
this or these sums placed at?


I dont understand what need to change in

Const DataStartRow As Long = 3 - this dont understand
Const DataColumn As String = "A" - this understand

With Worksheets("Sheet6") -this understand(place name
of my Sheet)

BTW tnx very much
i need individual sums per country and then delete unwanted
country's.
need only summation and one country