Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Check row above for information if it has contents copypaste empty

I am trying to get this macro

For Operation = 2 To Cells(Rows.Count, "B").End(xlUp).Row
If Len(Application.Trim(Cells(Operation, "A"))) < 1 Then Cells(Operation,
"A") = "Examine"
Next Operation

To perform these steps

Check each row in Column A for data
If the row contains data do nothing
If the row does not contain data check the row above it for data. If the
row above it has data enter the text €˜Closed into the empty row.

However, it will only work if data is in another Column but the same Row not
the same Column another row. Can you help?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default Check row above for information if it has contents copypasteempty

Maybe...(but test it!):

Option Explicit
Sub testme()

Dim wks As Worksheet
Dim OpRow As Long
Dim LastRow As Long 'just because I like to use a variable

Set wks = ActiveSheet

With wks
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row

'start at the bottom and work up
'stopping at row 3 so that row 2 isn't compared to row 1 (the header row)
For OpRow = LastRow To 3 Step -1
If Trim(.Cells(OpRow, "A").Value) = "" Then
'do nothing
Else
If Trim(.Cells(OpRow - 1, "A").Value) = "" Then
'do nothing
Else
.Cells(OpRow, "A").Value = "Closed"
End If
End If
Next OpRow
End With
End Sub



On 05/17/2010 11:32, TGalin wrote:
For Operation = 2 To Cells(Rows.Count, "B").End(xlUp).Row
If Len(Application.Trim(Cells(Operation, "A")))< 1 Then Cells(Operation,
"A") = "Examine"
Next Operation

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
Select all rows till last row with value in Column A and CopyPaste PVANS Excel Programming 7 March 19th 10 01:51 PM
Delete rows if AF and AY empty but F has information Louie Excel Worksheet Functions 6 March 4th 10 09:51 PM
CopyPaste Ivica Lopar Excel Programming 2 November 22nd 05 12:33 AM
FormatConditions appears to kill copypaste [email protected] Excel Programming 2 October 18th 05 11:06 PM
VBA code need help on CopyPaste alienscript Excel Programming 5 December 18th 03 04:51 PM


All times are GMT +1. The time now is 01:13 AM.

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

About Us

"It's about Microsoft Excel"