Above cell
Solved/Closed
motorsito
-
22 Apr 2009 à 14:12
motorsito Posts 2 Registration date Tuesday 21 April 2009 Status Member Last seen 23 April 2009 - 23 Apr 2009 à 10:13
motorsito Posts 2 Registration date Tuesday 21 April 2009 Status Member Last seen 23 April 2009 - 23 Apr 2009 à 10:13
3 responses
aquarelle
Posts
7181
Registration date
Saturday 7 April 2007
Status
Moderator
Last seen
14 February 2026
491
22 Apr 2009 à 15:28
22 Apr 2009 à 15:28
Hi,
1) Next time, it would be a good idea to salute people who could help you, OK ? ;)
2) Concerning your problem to write "different than above" in VBA, you just have to use <>
For example :
If Cell <> "0" then ...
Hope this help you.
Best regards
1) Next time, it would be a good idea to salute people who could help you, OK ? ;)
2) Concerning your problem to write "different than above" in VBA, you just have to use <>
For example :
If Cell <> "0" then ...
Hope this help you.
Best regards
motorsito
Posts
2
Registration date
Tuesday 21 April 2009
Status
Member
Last seen
23 April 2009
22 Apr 2009 à 17:04
22 Apr 2009 à 17:04
Hi there, sorry for the lack of manners in the previous post, I apologize.
regarding yourtip, is helpful, no doubt, but it's not that simple, remember I need the whole frase "diferent than above", I know tha <> means "diferent than".
for example:for each c. in range("a1:a2000")
if c.value <> (here I need the frase"than above")then
selection.entirerow. insert
enf if
next
regarding yourtip, is helpful, no doubt, but it's not that simple, remember I need the whole frase "diferent than above", I know tha <> means "diferent than".
for example:for each c. in range("a1:a2000")
if c.value <> (here I need the frase"than above")then
selection.entirerow. insert
enf if
next
Maybe this will get you in the right direction.
Hope this helps!
Private Sub InsertRow()
Dim LastRow As Integer
Dim intRow As Integer
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
For intRow = LastRow To 2 Step -1
Rows(intRow).Select
If Cells(intRow, 1).Value <> Cells(intRow, 1).Offset(-1, 0).Value Then
Cells(intRow, 1).Select
Selection.EntireRow.Insert
End If
Next intRow
Range("A1").Select
End Sub
Hope this helps!
Private Sub InsertRow()
Dim LastRow As Integer
Dim intRow As Integer
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
For intRow = LastRow To 2 Step -1
Rows(intRow).Select
If Cells(intRow, 1).Value <> Cells(intRow, 1).Offset(-1, 0).Value Then
Cells(intRow, 1).Select
Selection.EntireRow.Insert
End If
Next intRow
Range("A1").Select
End Sub
Sorry, remove "Private" before Sub. I coded it in a command button first.
Sub InsertRow()
Dim LastRow As Integer
Dim intRow As Integer
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
For intRow = LastRow To 2 Step -1
Rows(intRow).Select
If Cells(intRow, 1).Value <> Cells(intRow, 1).Offset(-1, 0).Value Then
Cells(intRow, 1).Select
Selection.EntireRow.Insert
End If
Next intRow
Range("A1").Select
End Sub
Sub InsertRow()
Dim LastRow As Integer
Dim intRow As Integer
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
For intRow = LastRow To 2 Step -1
Rows(intRow).Select
If Cells(intRow, 1).Value <> Cells(intRow, 1).Offset(-1, 0).Value Then
Cells(intRow, 1).Select
Selection.EntireRow.Insert
End If
Next intRow
Range("A1").Select
End Sub
aquarelle
Posts
7181
Registration date
Saturday 7 April 2007
Status
Moderator
Last seen
14 February 2026
491
23 Apr 2009 à 08:37
23 Apr 2009 à 08:37
Hi,
Arff, sorry for my misunderstanding, fortunately WutUp WutUp gave you the solution.
Have a nice day
Arff, sorry for my misunderstanding, fortunately WutUp WutUp gave you the solution.
Have a nice day
motorsito
Posts
2
Registration date
Tuesday 21 April 2009
Status
Member
Last seen
23 April 2009
23 Apr 2009 à 10:13
23 Apr 2009 à 10:13
Good Morning to all,Great, with some minor changes to cutomize it, the solution from WutUp is the solution, thanks, it works great.