ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   if header row leave a statement (https://www.excelbanter.com/excel-programming/425377-if-header-row-leave-statement.html)

duhrl[_3_]

if header row leave a statement
 

I'm a newbie to excel macro's, i know enough to get into trouble.
What i have is a macro that when I run it i need it to find the first
row of data, But if that row happens to be A3 I need it to leave a
statment "No exceptions as of" in A4 since A3 is my header row.

I believe

Dim rng1 As Range
Set rng1 = wstest.Range("A65536").End(xlUp)

is used to find the first row with data working from the bottom of the
column and working up. what is needed after this to place my comment?

thanks for your assistance.


--
duhrl
------------------------------------------------------------------------
duhrl's Profile: http://www.thecodecage.com/forumz/member.php?userid=126
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=73880


Susan

if header row leave a statement
 
if i understand you correctly:

Dim myLastRow as long
dim myFirstRow as long
Dim rng1 As Range

myLastRow = wstest.range("A65536").end(xlUp)
'this will find the LAST row of data

myFirstRow = wstest.range("A1").end(xlDown)
'this will find the FIRST row of data (after A1)

Set rng1 = wstest.Range("A" & myFirstRow +1 & ":xxxxx" & myLastRow)
'i added 1 to your first row to leave space for your comment
'xxxxx represents your last column, i didn't know what it was

hope that helps! watch out for text wrapping - if you get any red
text it means the line broke on text wrapping.
:)
susan




On Mar 11, 8:13*am, duhrl wrote:
I'm a newbie to excel macro's, i know enough to get into trouble.
What i have is a macro that when I run it i need it to find the first
row of data, But if that row happens to be A3 I need it to leave a
statment "No exceptions as of" in A4 since A3 is my header row.

I believe

Dim rng1 As Range
Set rng1 = wstest.Range("A65536").End(xlUp)

is used to find the first row with data working from the bottom of the
column and working up. what is needed after this to place my comment?

thanks for your assistance.

--
duhrl
------------------------------------------------------------------------
duhrl's Profile:http://www.thecodecage.com/forumz/member.php?userid=126
View this thread:http://www.thecodecage.com/forumz/sh...ad.php?t=73880




All times are GMT +1. The time now is 09:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com