Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

In range, name a single-cell range the text in the field to the right of the cell

Posted on 2011-03-10
3
Medium Priority
?
237 Views
Last Modified: 2012-05-11
I have various named ranges that, for example, go from N6:S22.  However within this range, in the column Q, in each row in the range, the cell in column Q needs to be range-named the text that is in column R for that cell.  For example, cell Q15 needs to be range-named what the text is in cell R22.  So, i have a range names "ss_WAL" that is N6:S22,  I need to loop through the Q6:Q22 cells and range-name them the values in R6:R22.  All this must be done in VBA.  I have the below but am not sure how to proceed.
With ThisWorkbook.Worksheets("Datasource").Range("ss_WAL")
                    .Cells(intCount, 4).AddComment Me.txtRangeName.Value  'Adds comment with range name
                    .Cells(intCount, 4).Name = .Cells(intCount, 5).text   'Defines the name of the range for the column number
End With

Open in new window

0
Comment
Question by:ssmith94015
[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 30

Accepted Solution

by:
SiddharthRout earned 2000 total points
ID: 35098534
You can do this simply using this

With Worksheets("Datasource")
    For i = 6 To 22
        .Range("Q" & i).Name = .Range("R" & i).Value
    Next
End With

Open in new window


Sid
0
 

Author Comment

by:ssmith94015
ID: 35102177
Sid, let me try that.  
0
 

Author Closing Comment

by:ssmith94015
ID: 35109909
It works perfectly.  Now, am posting another related question on this top that extends what I need to do.
0

Featured Post

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
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.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

721 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