?
Solved

trying to get value from cell -1 from target.column

Posted on 2013-11-12
3
Medium Priority
?
255 Views
Last Modified: 2013-11-13
excel 2010 vba

I have an event:
xlApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)

where my "Target"
is being passed into the procedure.

What I need:

I determine the value of the Target.Column value  ....by passing a variable
mRangeColumn (this is the Column Number example "6")

Once I determine what value " Target.Value" is...
I want to get the value to the left of Target.Value
Dim strNameBox As Range
Dim strColumnBox As Integer

        On Error Resume Next
        If Target.Column = "" Then
            If Target.Column = mRangeColumn Then
                
             strColumnBox = Target.Column - 1 
                
 strNameBox.Column = strColumnBox <------ error here
"wrong number of arguments or invalid property assignment"

                
               UserForm2.TextBox1.Value = Target.Value
               UserForm2.ComboBox1.Value = strNameBox.Value
            Else
                ' code
            End If
        Else
            ' code
        End If

Open in new window

0
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 39643838
Hi,

 Since strNameBox is a range ( I suppose you want only a cell you have to give the row as well)

Set strNameBox = Range(Cells(1, strColumnBox))

Open in new window


Regards
0
 
LVL 3

Author Comment

by:fordraiders
ID: 39643900
ok Changed:
Dim strNameBox As String

 strNameBox = Target.Offset(0, -1)

This will do it...
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 39644786
Thanks, Got me on the right track anyway.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question