Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Find last blank row and use in a formula

I have been trying to write a formula to a cell for hours and can't seem to
get it to work. I need to do the following:

Find the last blank row
set cell C2 with COUNTIF($b$2:$b$ lastblankrow,A2)
Copy the formula down from C2 until the last blank row (haven't gotten that
far yet)

Below is one of the many many ways I've tried this unsuccessfully. Can
someone help me? Thanks.

Set LastRowTemp = Cells(Rows.Count, 1).End(xlUp)(2).Row
Worksheets("DuplicateParts").Range("C2").Formula = "=CountIf(Range("B2:B
& LastRowTemp"),Range("A2"))"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Find last blank row and use in a formula

Do you really mean the last blank row or the first blank row after the last
row of data??
--
Gary''s Student - gsnu200810


"Alex" wrote:

I have been trying to write a formula to a cell for hours and can't seem to
get it to work. I need to do the following:

Find the last blank row
set cell C2 with COUNTIF($b$2:$b$ lastblankrow,A2)
Copy the formula down from C2 until the last blank row (haven't gotten that
far yet)

Below is one of the many many ways I've tried this unsuccessfully. Can
someone help me? Thanks.

Set LastRowTemp = Cells(Rows.Count, 1).End(xlUp)(2).Row
Worksheets("DuplicateParts").Range("C2").Formula = "=CountIf(Range("B2:B
& LastRowTemp"),Range("A2"))"

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Find last blank row and use in a formula

On Oct 28, 4:12*pm, Alex wrote:
I have been trying to write a formula to a cell for hours and can't seem to
get it to work. *I need to do the following:

Find the last blank row
set cell C2 with COUNTIF($b$2:$b$ lastblankrow,A2)
Copy the formula down from C2 until the last blank row (haven't gotten that
far yet)

Below is one of the many many ways I've tried this unsuccessfully. *Can
someone help me? Thanks.

Set LastRowTemp = Cells(Rows.Count, 1).End(xlUp)(2).Row
* *Worksheets("DuplicateParts").Range("C2").Formula = "=CountIf(Range("B2:B
& LastRowTemp"),Range("A2"))"


Try this site:

http://www.ozgrid.com/VBA/ExcelRanges.htm

It will show how to get the last cell containing data. But be
careful: If you clear data in the last cell and then try to get the
last cell again, it will point the empty cell. If you wanted to get
the last cell again, you'd have to save your workbook, close it, then
reopen it then try again. From what I can tell, there is no work-
around for this. It's just the way it is.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Find last blank row and use in a formula

Hi

This should do it:

LastRowTemp = Cells(Rows.Count, 1).End(xlUp)(2).Row
MyFormula = "=CountIf(B2:B" & LastRowTemp & ",A2)"
Worksheets("DuplicateParts").Range("C2").Formula = MyFormula

Regards,
Per

On 28 Okt., 22:12, Alex wrote:
I have been trying to write a formula to a cell for hours and can't seem to
get it to work. *I need to do the following:

Find the last blank row
set cell C2 with COUNTIF($b$2:$b$ lastblankrow,A2)
Copy the formula down from C2 until the last blank row (haven't gotten that
far yet)

Below is one of the many many ways I've tried this unsuccessfully. *Can
someone help me? Thanks.

Set LastRowTemp = Cells(Rows.Count, 1).End(xlUp)(2).Row
* *Worksheets("DuplicateParts").Range("C2").Formula = "=CountIf(Range("B2:B
& LastRowTemp"),Range("A2"))"


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Find last blank row and use in a formula

The first blank row after the last row of data. What I've written below is
finding the first blank row in column A. I need to find the first blank row
after the last row of data in either column A or B, whichever has more data
in the row. Thanks.

"Gary''s Student" wrote:

Do you really mean the last blank row or the first blank row after the last
row of data??
--
Gary''s Student - gsnu200810


"Alex" wrote:

I have been trying to write a formula to a cell for hours and can't seem to
get it to work. I need to do the following:

Find the last blank row
set cell C2 with COUNTIF($b$2:$b$ lastblankrow,A2)
Copy the formula down from C2 until the last blank row (haven't gotten that
far yet)

Below is one of the many many ways I've tried this unsuccessfully. Can
someone help me? Thanks.

Set LastRowTemp = Cells(Rows.Count, 1).End(xlUp)(2).Row
Worksheets("DuplicateParts").Range("C2").Formula = "=CountIf(Range("B2:B
& LastRowTemp"),Range("A2"))"

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
Average Formula to display blank cell if named range is blank Rachael F Excel Worksheet Functions 3 February 22nd 08 05:05 PM
Start Cell B1 then find first blank cell, insert subtotal, next non blank, then next blank, sutotal cells in between......... [email protected][_2_] Excel Programming 2 June 7th 07 09:27 PM
Find First Non blank cell than find column header and return that value Silver Rose Excel Worksheet Functions 10 April 30th 07 05:56 PM
Formula to find equal values with blank cells hilltop55 Excel Discussion (Misc queries) 5 March 22nd 07 09:12 PM
How Do I find/replace a blank cell with a formula? Alvin Excel Worksheet Functions 2 June 23rd 06 08:25 PM


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