ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What is The ORng value after this code is run? (https://www.excelbanter.com/excel-programming/363615-what-orng-value-after-code-run.html)

Roundy

What is The ORng value after this code is run?
 
This is part of a shopping cart like application I am running. For some
reason, when items are added to the cart now, they go to the wrong place on
the sheet, I think this is the satetment I need to correct, but I don't have
enough understanding of it to make the corrections.

Dim Inrng As Range
Dim ORng As Range
Dim inWs As Worksheet
Dim outWs As Worksheet
Dim iLastRow As Long

Set inWs = ActiveSheet
Set outWs = Worksheets("Order Form")
Set ORng = outWs.Cells(outWs.Cells(Rows.Count, 1).End(xlUp).Row + 1, "A")


TIA


Jim Thomlinson

What is The ORng value after this code is run?
 
ORng is a range object pointing to the blank cell just below the data in
column A
Add this line of code to see what I mean...

Dim Inrng As Range
Dim ORng As Range
Dim inWs As Worksheet
Dim outWs As Worksheet
Dim iLastRow As Long

Set inWs = ActiveSheet
Set outWs = Worksheets("Order Form")
Set ORng = outWs.Cells(outWs.Cells(Rows.Count, 1).End(xlUp).Row + 1, "A")
msgbox ORng.address '***This new line will display the address


--
HTH...

Jim Thomlinson


"Roundy" wrote:

This is part of a shopping cart like application I am running. For some
reason, when items are added to the cart now, they go to the wrong place on
the sheet, I think this is the satetment I need to correct, but I don't have
enough understanding of it to make the corrections.

Dim Inrng As Range
Dim ORng As Range
Dim inWs As Worksheet
Dim outWs As Worksheet
Dim iLastRow As Long

Set inWs = ActiveSheet
Set outWs = Worksheets("Order Form")
Set ORng = outWs.Cells(outWs.Cells(Rows.Count, 1).End(xlUp).Row + 1, "A")


TIA



All times are GMT +1. The time now is 01:48 AM.

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