Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
mju mju is offline
external usenet poster
 
Posts: 29
Default urgent help with finding last used cell and looping. Thanks!!!

How do I find the blank cell in a specific column(M), delete all blank rows
below, and then select the cells with data which is from Column A:M.

Thanks.

My problem is deleting the empty rows after the last cell with data, then
selecting the cells to loop tru until end of row with data.

Below are few of my codes. It is allover the place.

im cur_rng As Range
Columns("M:M").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Activate

For Each cur_rng In Selection
If IsEmpty(cur_rng) Then
If cur_rng.Row 2 Then
cur_rng.Value = cur_rng.Offset(-1, 0).Value
End If
End If
Next cur_rng



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default urgent help with finding last used cell and looping. Thanks!!!

when removing empty rows, I have always found it useful to start at the
bottom of the range and go up. For example:
I place my cursor in the last row of the range and then run this
do until activecell.row=1
activecell.offset(-1,0).select
if activecell.offset(1,0).value="" then
activecell.offset(1,0).entirerow.delete
end if
loop

"mju" wrote:

How do I find the blank cell in a specific column(M), delete all blank rows
below, and then select the cells with data which is from Column A:M.

Thanks.

My problem is deleting the empty rows after the last cell with data, then
selecting the cells to loop tru until end of row with data.

Below are few of my codes. It is allover the place.

im cur_rng As Range
Columns("M:M").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Activate

For Each cur_rng In Selection
If IsEmpty(cur_rng) Then
If cur_rng.Row 2 Then
cur_rng.Value = cur_rng.Offset(-1, 0).Value
End If
End If
Next cur_rng



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default urgent help with finding last used cell and looping. Thanks!!!

LastRow = Range("M1").End(xlDown).Row
Rows((LastRow + 1) & ":" & Rows.Count).Delete

DataRange = Range("A1:M" & LastRow)


"mju" wrote:

How do I find the blank cell in a specific column(M), delete all blank rows
below, and then select the cells with data which is from Column A:M.

Thanks.

My problem is deleting the empty rows after the last cell with data, then
selecting the cells to loop tru until end of row with data.

Below are few of my codes. It is allover the place.

im cur_rng As Range
Columns("M:M").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Activate

For Each cur_rng In Selection
If IsEmpty(cur_rng) Then
If cur_rng.Row 2 Then
cur_rng.Value = cur_rng.Offset(-1, 0).Value
End If
End If
Next cur_rng



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default urgent help with finding last used cell and looping. Thanks!!!

I left the work SET off the code

LastRow = Range("M1").End(xlDown).Row
Rows((LastRow + 1) & ":" & Rows.Count).Delete

Set DataRange = Range("A1:M" & LastRow)


"mju" wrote:

How do I find the blank cell in a specific column(M), delete all blank rows
below, and then select the cells with data which is from Column A:M.

Thanks.

My problem is deleting the empty rows after the last cell with data, then
selecting the cells to loop tru until end of row with data.

Below are few of my codes. It is allover the place.

im cur_rng As Range
Columns("M:M").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Activate

For Each cur_rng In Selection
If IsEmpty(cur_rng) Then
If cur_rng.Row 2 Then
cur_rng.Value = cur_rng.Offset(-1, 0).Value
End If
End If
Next cur_rng



  #5   Report Post  
Posted to microsoft.public.excel.programming
mju mju is offline
external usenet poster
 
Posts: 29
Default urgent help with finding last used cell and looping. Thanks!!!

thanks alot!!!! it worked!!! U guys rock!!!***doing the moonwalk dance:)-**

"Joel" wrote:

I left the work SET off the code

LastRow = Range("M1").End(xlDown).Row
Rows((LastRow + 1) & ":" & Rows.Count).Delete

Set DataRange = Range("A1:M" & LastRow)


"mju" wrote:

How do I find the blank cell in a specific column(M), delete all blank rows
below, and then select the cells with data which is from Column A:M.

Thanks.

My problem is deleting the empty rows after the last cell with data, then
selecting the cells to loop tru until end of row with data.

Below are few of my codes. It is allover the place.

im cur_rng As Range
Columns("M:M").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Activate

For Each cur_rng In Selection
If IsEmpty(cur_rng) Then
If cur_rng.Row 2 Then
cur_rng.Value = cur_rng.Offset(-1, 0).Value
End If
End If
Next cur_rng





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default urgent help with finding last used cell and looping. Thanks!!!

Hi,

This isn't clear. We find the last cell in column M and then what? Delete
blank rows above that or below it?

Mike

"mju" wrote:

How do I find the blank cell in a specific column(M), delete all blank rows
below, and then select the cells with data which is from Column A:M.

Thanks.

My problem is deleting the empty rows after the last cell with data, then
selecting the cells to loop tru until end of row with data.

Below are few of my codes. It is allover the place.

im cur_rng As Range
Columns("M:M").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Activate

For Each cur_rng In Selection
If IsEmpty(cur_rng) Then
If cur_rng.Row 2 Then
cur_rng.Value = cur_rng.Offset(-1, 0).Value
End If
End If
Next cur_rng



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
finding average - Urgent Vicky Excel Discussion (Misc queries) 5 February 6th 09 04:32 AM
FINDING TOP 20 (URGENT PLEASE) FARAZ QURESHI Excel Discussion (Misc queries) 5 July 7th 08 09:34 AM
finding & looping Jase Excel Discussion (Misc queries) 0 May 13th 08 08:01 PM
urgent-looping through data validation list then printing as per each value kidkarma Excel Programming 3 February 26th 07 02:18 AM
urgent. looping thru all records and applynig formula to get new results shirley Excel Programming 2 April 29th 04 04:32 AM


All times are GMT +1. The time now is 02:55 AM.

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

About Us

"It's about Microsoft Excel"