Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Copy Contents from Cell

Hi,

I am trying to create a macro to insert a header into my worksheets. I
would like to be able to enter what the header is to say in a cell and create
a macro to copy those contents into the header portion to save me some time.
The catch is that the titles that i need to type in will change from time to
time, so the macro must be able to copy and paste dynamically. For example
this month the sheet might say "Global Economic Outlook" but next quarter it
might say, "Affects of Oil Demand". How can I get a macro to enter the
different data from the contents of a cell?

Thanks,

Dan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Copy Contents from Cell

Hi,

We write "Global Economic Outlook" to a cell in your worksheet (A1?) how
does this tell us where to get the data from and where to put it?

Mike

"Stonewall" wrote:

Hi,

I am trying to create a macro to insert a header into my worksheets. I
would like to be able to enter what the header is to say in a cell and create
a macro to copy those contents into the header portion to save me some time.
The catch is that the titles that i need to type in will change from time to
time, so the macro must be able to copy and paste dynamically. For example
this month the sheet might say "Global Economic Outlook" but next quarter it
might say, "Affects of Oil Demand". How can I get a macro to enter the
different data from the contents of a cell?

Thanks,

Dan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Copy Contents from Cell

This is the code that I have so far:

Dim cn As String
cn = InputBox("Please Enter Slide Title", "Slide Title")

If cn < "" Then
Range("S2").Value = cn
End If

Range("S2").Select
ActiveCell.Copy
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = _
"&""Times New Roman,Regular""&24"Global Economic Outlook""

Is there any way i can get "Global Economic Outlook" simply to be the
contents of cell S2? Will the code that you wrote down do the trick?

Thanks.

"Don Guillett" wrote:

Instead of a cell you could use

myheader=inputbox("Enter this months header")
range("a1").value=myheader

or a simple formula using your cell idea
=sheet1!c1


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stonewall" wrote in message
...
Hi,

I am trying to create a macro to insert a header into my worksheets. I
would like to be able to enter what the header is to say in a cell and
create
a macro to copy those contents into the header portion to save me some
time.
The catch is that the titles that i need to type in will change from time
to
time, so the macro must be able to copy and paste dynamically. For
example
this month the sheet might say "Global Economic Outlook" but next quarter
it
might say, "Affects of Oil Demand". How can I get a macro to enter the
different data from the contents of a cell?

Thanks,

Dan



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Copy Contents from Cell

Never do more to page setup than necessary as it is SLOOOOW

Sub setheaderfromrange()
With ActiveSheet.PageSetup
.LeftHeader = "&""Times New Roman,Regular""&24" & Range("s2")
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stonewall" wrote in message
...
This is the code that I have so far:

Dim cn As String
cn = InputBox("Please Enter Slide Title", "Slide Title")

If cn < "" Then
Range("S2").Value = cn
End If

Range("S2").Select
ActiveCell.Copy
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = _
"&""Times New Roman,Regular""&24"Global Economic Outlook""

Is there any way i can get "Global Economic Outlook" simply to be the
contents of cell S2? Will the code that you wrote down do the trick?

Thanks.

"Don Guillett" wrote:

Instead of a cell you could use

myheader=inputbox("Enter this months header")
range("a1").value=myheader

or a simple formula using your cell idea
=sheet1!c1


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stonewall" wrote in message
...
Hi,

I am trying to create a macro to insert a header into my worksheets. I
would like to be able to enter what the header is to say in a cell and
create
a macro to copy those contents into the header portion to save me some
time.
The catch is that the titles that i need to type in will change from
time
to
time, so the macro must be able to copy and paste dynamically. For
example
this month the sheet might say "Global Economic Outlook" but next
quarter
it
might say, "Affects of Oil Demand". How can I get a macro to enter the
different data from the contents of a cell?

Thanks,

Dan






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Copy Contents from Cell

Thank you! That worked perfectly.

"Don Guillett" wrote:

Never do more to page setup than necessary as it is SLOOOOW

Sub setheaderfromrange()
With ActiveSheet.PageSetup
.LeftHeader = "&""Times New Roman,Regular""&24" & Range("s2")
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stonewall" wrote in message
...
This is the code that I have so far:

Dim cn As String
cn = InputBox("Please Enter Slide Title", "Slide Title")

If cn < "" Then
Range("S2").Value = cn
End If

Range("S2").Select
ActiveCell.Copy
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = _
"&""Times New Roman,Regular""&24"Global Economic Outlook""

Is there any way i can get "Global Economic Outlook" simply to be the
contents of cell S2? Will the code that you wrote down do the trick?

Thanks.

"Don Guillett" wrote:

Instead of a cell you could use

myheader=inputbox("Enter this months header")
range("a1").value=myheader

or a simple formula using your cell idea
=sheet1!c1


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stonewall" wrote in message
...
Hi,

I am trying to create a macro to insert a header into my worksheets. I
would like to be able to enter what the header is to say in a cell and
create
a macro to copy those contents into the header portion to save me some
time.
The catch is that the titles that i need to type in will change from
time
to
time, so the macro must be able to copy and paste dynamically. For
example
this month the sheet might say "Global Economic Outlook" but next
quarter
it
might say, "Affects of Oil Demand". How can I get a macro to enter the
different data from the contents of a cell?

Thanks,

Dan




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Copy Contents from Cell

Glad to help.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stonewall" wrote in message
...
Thank you! That worked perfectly.

"Don Guillett" wrote:

Never do more to page setup than necessary as it is SLOOOOW

Sub setheaderfromrange()
With ActiveSheet.PageSetup
.LeftHeader = "&""Times New Roman,Regular""&24" & Range("s2")
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stonewall" wrote in message
...
This is the code that I have so far:

Dim cn As String
cn = InputBox("Please Enter Slide Title", "Slide Title")

If cn < "" Then
Range("S2").Value = cn
End If

Range("S2").Select
ActiveCell.Copy
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = _
"&""Times New Roman,Regular""&24"Global Economic Outlook""

Is there any way i can get "Global Economic Outlook" simply to be the
contents of cell S2? Will the code that you wrote down do the trick?

Thanks.

"Don Guillett" wrote:

Instead of a cell you could use

myheader=inputbox("Enter this months header")
range("a1").value=myheader

or a simple formula using your cell idea
=sheet1!c1


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stonewall" wrote in message
...
Hi,

I am trying to create a macro to insert a header into my worksheets.
I
would like to be able to enter what the header is to say in a cell
and
create
a macro to copy those contents into the header portion to save me
some
time.
The catch is that the titles that i need to type in will change from
time
to
time, so the macro must be able to copy and paste dynamically. For
example
this month the sheet might say "Global Economic Outlook" but next
quarter
it
might say, "Affects of Oil Demand". How can I get a macro to enter
the
different data from the contents of a cell?

Thanks,

Dan





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Copy Contents from Cell

I have run into another problem with setting the footer using this method as
well. I want to put page numbers on the footer with using the reference
"s3". When i run the code (adapted, of course) it will work fine with text,
but not with numbers. I even formatted the numbers as text and it did not
work.

Also I was wondering if there was a way to set all the headers and footers
by this method in a workbook at once, rather than having to go to each sheet
and run the macro.

Thanks in advance.

"Don Guillett" wrote:

Glad to help.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stonewall" wrote in message
...
Thank you! That worked perfectly.

"Don Guillett" wrote:

Never do more to page setup than necessary as it is SLOOOOW

Sub setheaderfromrange()
With ActiveSheet.PageSetup
.LeftHeader = "&""Times New Roman,Regular""&24" & Range("s2")
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stonewall" wrote in message
...
This is the code that I have so far:

Dim cn As String
cn = InputBox("Please Enter Slide Title", "Slide Title")

If cn < "" Then
Range("S2").Value = cn
End If

Range("S2").Select
ActiveCell.Copy
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = _
"&""Times New Roman,Regular""&24"Global Economic Outlook""

Is there any way i can get "Global Economic Outlook" simply to be the
contents of cell S2? Will the code that you wrote down do the trick?

Thanks.

"Don Guillett" wrote:

Instead of a cell you could use

myheader=inputbox("Enter this months header")
range("a1").value=myheader

or a simple formula using your cell idea
=sheet1!c1


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stonewall" wrote in message
...
Hi,

I am trying to create a macro to insert a header into my worksheets.
I
would like to be able to enter what the header is to say in a cell
and
create
a macro to copy those contents into the header portion to save me
some
time.
The catch is that the titles that i need to type in will change from
time
to
time, so the macro must be able to copy and paste dynamically. For
example
this month the sheet might say "Global Economic Outlook" but next
quarter
it
might say, "Affects of Oil Demand". How can I get a macro to enter
the
different data from the contents of a cell?

Thanks,

Dan






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy contents from one cell to another Don[_4_] New Users to Excel 0 September 25th 09 04:18 PM
Copy cell contents with VB TheMilkGuy Excel Discussion (Misc queries) 6 July 21st 09 11:46 PM
how to copy the contents from last cell Lamb Chop Excel Discussion (Misc queries) 2 January 17th 08 01:27 AM
Copy cell contents? NickHK Excel Programming 0 January 11th 07 02:46 AM
copy cell value not contents D Moran Excel Discussion (Misc queries) 2 April 24th 06 03:29 PM


All times are GMT +1. The time now is 11:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"