Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default CHECK END OF WORKSHEET DATA

Hi,
I want to write a macro which checks the end of worksheet in VBA. I wanted
to know are there any constants or function which identifies End of Active
Sheet like EOF as End of File.

--
Chanikya
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default CHECK END OF WORKSHEET DATA

See replies to similar query he

http://tinyurl.com/b2ajf

Hope this helps
Rowan

cndesu wrote:
Hi,
I want to write a macro which checks the end of worksheet in VBA. I wanted
to know are there any constants or function which identifies End of Active
Sheet like EOF as End of File.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default CHECK END OF WORKSHEET DATA

Hi,
Thanks for the reply. Already I got the solution right away. But the problm
for which I has asked is explained in detail as follows.
I wrote a macro in a worksheet. That worksheet contains a abnk statement
containing three columns first one as date second as payee information and
third naturally amount. The problem I had encountered is the payee
information has been split into numerous rows but in the same column. I want
to add up the payee information into one cell in a row where the first column
contains the date. I wrote the macro as follows but unsuccessful saying
object required at activecell.formula.cut or can I change the property from
formula to value. Does it works?
Worksheets("sheet1").Activate
Range("B26").Activate
Do
If ActiveCell.Formula = "" Then
ActiveCell.Offset(0, 1).Activate
ActiveCell.Formula.Cut
ActiveCell.Offset(-1, 0).Activate
ActiveCell.Formula.PasteSpecial (Operation =
xlPasteSpecialOperationAdd)
ActiveCell.Offset(1, 0).Activate
ActiveCell.Entire Row.Delete
ActiveCell.Offset(0, -1).Activate
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop Until ActiveCell.Row = ActiveSheet.Rows.Count

Please reply to this problem as soon as possible.

--
Chanikya


"Rowan Drummond" wrote:

See replies to similar query he

http://tinyurl.com/b2ajf

Hope this helps
Rowan

cndesu wrote:
Hi,
I want to write a macro which checks the end of worksheet in VBA. I wanted
to know are there any constants or function which identifies End of Active
Sheet like EOF as End of File.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CHECK END OF WORKSHEET DATA

Sub CleanUpData()
Dim lastRow as Long, i as Long
Dim sStr2 as String, sStr1 as String
Dim rng as Range
lastrow = cells(rows.count,2).End(xlup).row
for i = lastrow to 2 Step -1
if isempty(cells(i,3).Value) then
sStr2 = Trim(cells(i,2))
sStr1 = Trim(cells(i-1,2))
cells(i,2).Clearcontents
cells(i-1,2).Value = Replace(sStr1 & " " & sStr2,chr(10),"")
end if
Next
On Error Resume Next
set rng = columns(3).Specialcells(xlBlanks)
On Error goto 0
if not rng is nothing then
rng.EntireRow.Delete
End if
End Sub

Test this on a copy of your data.

--
Regards,
Tom Ogilvy


"cndesu" wrote in message
...
Hi,
Thanks for the reply. Already I got the solution right away. But the

problm
for which I has asked is explained in detail as follows.
I wrote a macro in a worksheet. That worksheet contains a abnk statement
containing three columns first one as date second as payee information and
third naturally amount. The problem I had encountered is the payee
information has been split into numerous rows but in the same column. I

want
to add up the payee information into one cell in a row where the first

column
contains the date. I wrote the macro as follows but unsuccessful saying
object required at activecell.formula.cut or can I change the property

from
formula to value. Does it works?
Worksheets("sheet1").Activate
Range("B26").Activate
Do
If ActiveCell.Formula = "" Then
ActiveCell.Offset(0, 1).Activate
ActiveCell.Formula.Cut
ActiveCell.Offset(-1, 0).Activate
ActiveCell.Formula.PasteSpecial (Operation =
xlPasteSpecialOperationAdd)
ActiveCell.Offset(1, 0).Activate
ActiveCell.Entire Row.Delete
ActiveCell.Offset(0, -1).Activate
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop Until ActiveCell.Row = ActiveSheet.Rows.Count

Please reply to this problem as soon as possible.

--
Chanikya


"Rowan Drummond" wrote:

See replies to similar query he

http://tinyurl.com/b2ajf

Hope this helps
Rowan

cndesu wrote:
Hi,
I want to write a macro which checks the end of worksheet in VBA. I

wanted
to know are there any constants or function which identifies End of

Active
Sheet like EOF as End of File.




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
how to check sorted data in an excel worksheet Tahera[_2_] Excel Discussion (Misc queries) 3 May 24th 10 12:26 PM
How to Check if Worksheet TAB is protected or Not Ananth Excel Discussion (Misc queries) 3 March 30th 09 01:08 PM
How do I copy a check box result from Worksheet A to Worksheet B? Javadan289 Excel Worksheet Functions 5 December 26th 06 07:25 PM
Check if worksheet is before another [email protected] Excel Discussion (Misc queries) 4 July 3rd 06 07:30 PM
How to check if a worksheet exists in worksheet collection Raghunandan Excel Programming 2 July 19th 04 06:55 AM


All times are GMT +1. The time now is 11:11 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"