Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default selecting the last non blank row.

I need to create a macro to select the last non blank row in a workshee
and then convert it into it's values ( the row has formulas on it, bu
i will need the values only when the macro runs). I hope this make
sense.

Thanks for your help

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default selecting the last non blank row.

To find the last USED row use this:

lastUsedRow = Worksheets("Sheet1").UsedRange.Row
Worksheets("Sheet1").UsedRange.Rows.Count - 1

To find the first EMPTY row after the last used row omit the "- 1" lik
so:

firstEmptyRow = Worksheets("Sheet1").UsedRange.Row
Worksheets("Sheet1").UsedRange.Rows.Count

The same works with Columns:

lastUsedCol = Worksheets("Sheet1").UsedRange.Column
Worksheets("Sheet1").UsedRange.Columns.Count - 1

- Piku

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default selecting the last non blank row.

Assuming your data was in column A, use:

Range("A65536").End(xlUp).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False



--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default selecting the last non blank row.

Thanks.

Is there a way to copy and paste the whole row instead of only on
column

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default selecting the last non blank row.

Hi
try
Range("A65536").End(xlUp).Select
Selection.entirerow.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

--
Regards
Frank Kabel
Frankfurt, Germany


Thanks.

Is there a way to copy and paste the whole row instead of only one
column?


---
Message posted from http://www.ExcelForum.com/



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default selecting the last non blank row.

Change:

Range("A65536").End(xlUp).Select

To:

Range("A65536").End(xlUp).EntireRow.Select



--
Message posted from http://www.ExcelForum.com

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
Can I delete blank rows from excel without selecting them? rgtest Excel Worksheet Functions 9 February 14th 09 03:12 PM
Average Formula to display blank cell if named range is blank Rachael F Excel Worksheet Functions 3 February 22nd 08 05:05 PM
Selecting non-blank cells Dave Excel Discussion (Misc queries) 3 November 2nd 06 08:51 PM
Selecting the first non blank cell in Range VBA Noob Excel Worksheet Functions 2 July 24th 06 07:39 PM
Selecting first blank row Audio_freak Excel Programming 3 September 6th 03 08:54 PM


All times are GMT +1. The time now is 06:14 PM.

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"