ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Row(line) No Syntax? (https://www.excelbanter.com/excel-programming/281209-vba-row-line-no-syntax.html)

Michael168[_44_]

VBA Row(line) No Syntax?
 
Can someone show the syntax in VBA for row no? I write a cell value from
sheet1 to a cell in sheet2. I would also like to write in the row no of
sheet1 in another cell of sheet2 so that I know where this value comes
from.

Thanks & Regards.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Hank Scorpio

VBA Row(line) No Syntax?
 
On Sat, 1 Nov 2003 00:19:44 -0500, Michael168
wrote:

A range has a Row property that you can use for this:

Sub InsertRowNo()

Dim rng As Range

'One way...

Worksheets(2).Range("A1") = ActiveCell.Value
Worksheets(2).Range("B1") = ActiveCell.Row

'Using a variable range...

Set rng = ActiveCell

Worksheets(2).Range("A2") = ActiveCell.Value
Worksheets(2).Range("B2") = ActiveCell.Row

End Sub


Can someone show the syntax in VBA for row no? I write a cell value from
sheet1 to a cell in sheet2. I would also like to write in the row no of
sheet1 in another cell of sheet2 so that I know where this value comes
from.



---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *


All times are GMT +1. The time now is 05:18 PM.

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