+ Reply to Thread
Results 1 to 4 of 4

Range("A1") = Sheets("Sheet2").CenterHeader.Text doesnt work.

Hybrid View

HerryMarkowitz Range("A1") =... 12-27-2013, 06:39 AM
TMS Re: Range("A1") =... 12-27-2013, 07:02 AM
Izandol Re: Range("A1") =... 12-27-2013, 07:04 AM
HerryMarkowitz Re: Range("A1") =... 12-27-2013, 07:06 AM
  1. #1
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,014

    Range("A1") = Sheets("Sheet2").CenterHeader.Text doesnt work.

    Hi,
    Following code is okey.
    Sub Macro1()
    Sheets("Sheet2").Select
    With ActiveSheet.PageSetup
        .PrintArea = "A1:A5"
        .LeftHeader = ""
        .CenterHeader = "EXAMPLE HEADER"
        .RightHeader = ""
    End With
    End Sub
    Following code is not okey.
    Sub Macro2()
    Sheets("Sheet1").Select
    Range("A1") = Sheets("Sheet2").CenterHeader.Text
    End Sub
    I want to take CenterHeader Text from Sheet2 to Sheet1.Range("A1") cell...

    Regards
    Sub DontForgetThese()
         If Your thread includes any code Then Please use code tags...
         If Your thread has been solved Then Please mark as solved...
         If Anybody has helped to you Then Please add reputation...
    End Sub

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,135

    Re: Range("A1") = Sheets("Sheet2").CenterHeader.Text doesnt work.

    Try:

    Sub Macro2()
    Sheets("Sheet1").Range("A1") = Sheets("Sheet2").PageSetup.CenterHeader.Text
    End Sub

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Range("A1") = Sheets("Sheet2").CenterHeader.Text doesnt work.

    CenterHeader is not Object, it is String:
    Sheets("Sheet2").PageSetup.CenterHeader
    with no .Text
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  4. #4
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,014

    Re: Range("A1") = Sheets("Sheet2").CenterHeader.Text doesnt work.

    Thank you Izandol. Solved.
    Last edited by HerryMarkowitz; 12-27-2013 at 07:09 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 01-02-2014, 02:15 PM
  2. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  3. Replies: 2
    Last Post: 06-06-2013, 12:45 PM
  4. [SOLVED] Sheets("Sheet2").Range("AA1") = "Note"
    By dcburkejr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-03-2012, 04:10 PM
  5. How can i copy value from "HTMLText"(EMBED("Forms.HTML:Text","")),using Macro
    By andrewyang in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2010, 12:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1