Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display cell locations for all populated columns in Excel 2007

Status
Not open for further replies.

kdjonesmtb2

Technical User
Nov 19, 2012
93
US
Is there a macro that can be developed for Excel 2007 that print out the Cell locations for a header row

The Header row is from AA-HI

I want to be able see the following as the result

Header1 Header2

A1 B2

Etc
 
hi,
The Header row is from [highlight]AA-HI[/highlight]

However, your [highlight]example[/highlight] is different???

[pre]
Header1 Header2

[highlight]A1 B2[/highlight]
[/pre]

I am confused!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Sorry for the typo

I am looking for the following

Header 1; Header2; Header3
A1 B1 C1


Another example

Name SSN DOB

A1 B1 C1

 
How are ya kdjonesmtb2 . . .

A starting point. This function will print any range you pass to it from the activeworkbook.activesheet:

Code:
[blue]Public Function PrtRng(Rng As String)
   Dim WrkSht As Worksheet
   
   Set WrkSht = ActiveWorkbook.ActiveSheet
   
   With WrkSht.PageSetup
      .PrintArea = Rng
      .Zoom = False
      .FitToPagesTall = 1
      .FitToPagesWide = 1
      .Orientation = xlLandscape
   End With
   
   WrkSht.PrintOut Copies:=1
   
   Set WrkSht = Nothing
   
End Function[/blue]

[blue]Your Thoughts? . . .[/blue]

See Ya . . .

Be sure to see FAQ219-2884 Worthy Reading! [thumbsup2]
Also FAQ181-2886 Worthy Reading! [thumbsup2]
 
and can I ask what you intend to do with this data?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hello

I am actually looking to print the Excel internal grid column names that are normally not printed on a spreadsheet output

How do I get the actual 'A1, B1, C1 - cell location information to print with the associated user entered row 1 headers?

For example Excel grid

Column Header - Name
Cell reference - A1


Output into a new worksheet

Name-[A1],SSN-[B1], DOB[C1], etc
 
The HP QTP testing tool utilizes XLS worksheets as datatable feeds for processing automated test cases

I need to identify in the QTP testing script the specific cell column locations for script processing and I wanted a tool to identify the cell locations in a systematic method rather than manually identifying the header cell locations

thanks
 
I understand WHAT you want to do.

I'm trying to find out WHY.

But a quick solution is to go into Page Setup > Sheet TAB and select Row & Colummn Headings. In all my years as an Excel user (nearly 20) I have never used this option or found it useful. So I'd like to know how you might find it useful.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Assumptions:

Your target sheet name is target
You only have one table on the target sheet, with headings in the first row of the table
The output sheet is the active sheet

Code:
Sub test()
    Dim r As Range, iCol As Integer
    
    With Sheets("target").UsedRange
        For Each r In Intersect(.Cells, .Cells(1, "A").EntireRow)
            iCol = iCol + 1
            ActiveSheet.Cells(1, iCol).Value = r.Value
            ActiveSheet.Cells(2, iCol).Value = r.Address(False, False)
        Next
    End With
End Sub


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top