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
215 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
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 500 total points
Comment Utility
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
Comment Utility
Sid, let me try that.  
0
 

Author Closing Comment

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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now