TRUE instead of a number

braindiesel

Well-known Member
Joined
Mar 16, 2009
Messages
571
Office Version
  1. 365
  2. 2019
  3. 2010
Platform
  1. Windows
I am working on a large document.
In the macro, this line of code

Sheets("backstage").Range("adjStaffCurRow").Value = Selection.Row

should yield the row number in my cell named adjStaffCurRow

Instead, I get "TRUE"

I have had this issue in other areas as well, using a list index where instead of saying the correct row number, I get TRUE as a result.

This is using Excel 2007.

Am I missing something? I have asked this question before and still have no solution. I would really appreciate any assistance in correcting this error.

Thanks in advance,
Glen
 
Open a new workbook

does it work every time in a new workbook

If so

you probably have some code triggered on selection change or cell change or workbook change doing something else to the named range
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I haven't tried it in a new workbook, but this workbook contains over 30 sheets and about 40 pages of code. I really don't want to start over
No, not start again - I meant just to satisfy yourself that the code works as you'd expect it to. It works every time for me, not just every second time.

You don't have a Worksheet_Change event which is selecting a different cell as it executes, by any chance?
 
Last edited:
Upvote 0
Code:
Sub Foo()
CurrRow = ActiveCell.Row
Range("MyRowNum").Value = CurrRow  'Name MyRowNum previously assigned to Cell of choice
End Sub
 
Upvote 0

Forum statistics

Threads
1,225,156
Messages
6,183,237
Members
453,152
Latest member
ChrisMd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top