Userform get value of row one in column of selected cell

fonk

New Member
Joined
Mar 30, 2009
Messages
49
Hi all,
I have a userform that retreives data from a selected spreadsheet that has date values in columns A,B,F,G,K,L,P,Q,U,V as non contiguous data. I have a find that selects the maxVal date cell, then I want it to go to the first row in the column to get the header data along with the selected date (active cell) values for display on the userform. Using xlUp only takes me to the next populated cell up, do I need to do a loop to find the top header cell or is there an alternative?

The line of code I am having troule with is below,

Code:
tb_LastEntry.Value = ActiveCell.End(xlUp).Value & " - " & ActiveCell.Value
I've been searching for quite a while and had no luck, seen lots of row macros but can't (or don't have the knowledge) change it to what I want.
Regards, Dave
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Does this help you at all?

Code:
tb_LastEntry.Value = Cells(1, ActiveCell.Column).Value & " - " & ActiveCell.Value
 
Upvote 0
Hi davesweep,
Thanks for the reply, I have tried that one and when I mouse over the
Code:
Cells(1, ActiveCell.Column).Value
the value is not displayed, no an error message. On the
Code:
ActiveCell.Value
which is displaying the date as expected.
In the Add Watch I am getting the following when it is running:
Watch : : Cells(1, ActiveCell.Column).Value : Empty : Variant/Empty : usrfmWkDysEmp.CmdGo_Click
Then it goes to the below on End Sub
Watch : : Cells(1, ActiveCell.Column).Value : Empty : Variant/Empty : usrfmWkDysEmp.CmdGo_Click

When I run it the userform displays " - 3/4/2012" (without the inverted) commas.
Regards, Dave
 
Last edited:
Upvote 0
Hi,
A copy/paste error in the last one, see the Watch value at End Sub.

In the Add Watch I am getting the following when it is running:
Watch : : Cells(1, ActiveCell.Column).Value : Empty : Variant/Empty : usrfmWkDysEmp.CmdGo_Click
Then it goes to the below on End Sub
Watch : : Cells(1, ActiveCell.Column).Value :<out of context> <OUT context of>: Variant/Empty : usrfmWkDysEmp.CmdGo_Click

Regards, Dave
 
Last edited:
Upvote 0
Hi davesweep,
Yes, getting ActiveCell.Column = 12 which is correct for Column L where the value is.
Regards, Dave
 
Last edited:
Upvote 0
Hi davesweep,
Sorted thanks, should have paid attention to the Add Watch where it said "empty", commited the sin of the header being in a merged cell. Thanks for the assistance.
Regards, Dave
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,573
Members
449,089
Latest member
Motoracer88

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