Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default copy row 2 of any wsheet to the new crated wsheet

Hi there!
I have the code bellow that allow me to create and name the new wsheet,
now i need to copy what is in the row 2 of the prior wsheet or any sheet,
because all sheets have the same header.

apreciate all the help.

thanks

celio3c


Public Sub newWsheet()
Dim Message, Title, Default, MyValue
Message = "Enter a name for the new Worksheet" ' Set prompt.
Title = "Add New sheet Input Box" '
Set title.
Default = "Give me a Name" '
Set default.
MyValue = InputBox(Message, Title, Default) '
'Display message, title, and default value.

Set NewSheet = Worksheets.Add
NewSheet.Name = MyValue
cmbWsheet.AddItem MyValue

End Sub
--
celio3c
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 28
Default copy row 2 of any wsheet to the new crated wsheet


Dim samplerow As Range
Set samplerow = ActiveSheet.Rows(2)

'Display message, title, and default value.
Dim Message, Title, Default, MyValue
Message = "Enter a name for the new Worksheet" '
Set prompt.
Title = "Add New sheet Input
Box" 'Set title.
Default = "Give me a
Name" 'Set default.
MyValue = InputBox(Message, Title, Default) '


Set NewSheet = Worksheets.Add
NewSheet.Name = MyValue
'cmbWsheet.AddItem MyValue

NewSheet.Activate
NewSheet.Cells(2, 1).Select

samplerow.Copy
ActiveSheet.Paste

ActiveSheet.Cells(1, 1).Activate

I hope this helps...

Selva V Pasupathy
For more on Excel, VBA, & other Resources
Please visit: http://socko.wordpress.com
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default copy row 2 of any wsheet to the new crated wsheet

Sub addsheet()
Set oldsheet = ActiveSheet
MyValue = InputBox("Enter a name", "Add New Sheet Input Box")
Set NewSheet = Worksheets.Add
NewSheet.Name = MyValue
oldsheet.Rows("2:2").Copy Destination:=ActiveSheet.Range("A2")
End Sub


Gord Dibben MS Excel MVP

On Thu, 18 Dec 2008 20:04:01 -0800, celio3c
wrote:

Hi there!
I have the code bellow that allow me to create and name the new wsheet,
now i need to copy what is in the row 2 of the prior wsheet or any sheet,
because all sheets have the same header.

apreciate all the help.

thanks

celio3c


Public Sub newWsheet()
Dim Message, Title, Default, MyValue
Message = "Enter a name for the new Worksheet" ' Set prompt.
Title = "Add New sheet Input Box" '
Set title.
Default = "Give me a Name" '
Set default.
MyValue = InputBox(Message, Title, Default) '
'Display message, title, and default value.

Set NewSheet = Worksheets.Add
NewSheet.Name = MyValue
cmbWsheet.AddItem MyValue

End Sub


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default copy row 2 of any wsheet to the new crated wsheet

Shorter yet.

Sub addsheet()
Set oldsheet = ActiveSheet
MyValue = InputBox("Enter a name", "Add New Sheet Input Box")
Worksheets.Add.Name = MyValue
oldsheet.Rows("2:2").Copy Destination:=ActiveSheet.Range("A2")
End Sub


Gord

On Fri, 19 Dec 2008 13:53:39 -0800, Gord Dibben <gorddibbATshawDOTca wrote:

Sub addsheet()
Set oldsheet = ActiveSheet
MyValue = InputBox("Enter a name", "Add New Sheet Input Box")
Set NewSheet = Worksheets.Add
NewSheet.Name = MyValue
oldsheet.Rows("2:2").Copy Destination:=ActiveSheet.Range("A2")
End Sub


Gord Dibben MS Excel MVP

On Thu, 18 Dec 2008 20:04:01 -0800, celio3c
wrote:

Hi there!
I have the code bellow that allow me to create and name the new wsheet,
now i need to copy what is in the row 2 of the prior wsheet or any sheet,
because all sheets have the same header.

apreciate all the help.

thanks

celio3c


Public Sub newWsheet()
Dim Message, Title, Default, MyValue
Message = "Enter a name for the new Worksheet" ' Set prompt.
Title = "Add New sheet Input Box" '
Set title.
Default = "Give me a Name" '
Set default.
MyValue = InputBox(Message, Title, Default) '
'Display message, title, and default value.

Set NewSheet = Worksheets.Add
NewSheet.Name = MyValue
cmbWsheet.AddItem MyValue

End Sub


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default copy row 2 of any wsheet to the new crated wsheet

Thanks Socko and Gord

it did worked, perhaps i need a litle more to cover the situation, what if
the name entered already exist, i'm getting a error on that.
--
celio3c


"Gord Dibben" wrote:

Shorter yet.

Sub addsheet()
Set oldsheet = ActiveSheet
MyValue = InputBox("Enter a name", "Add New Sheet Input Box")
Worksheets.Add.Name = MyValue
oldsheet.Rows("2:2").Copy Destination:=ActiveSheet.Range("A2")
End Sub


Gord

On Fri, 19 Dec 2008 13:53:39 -0800, Gord Dibben <gorddibbATshawDOTca wrote:

Sub addsheet()
Set oldsheet = ActiveSheet
MyValue = InputBox("Enter a name", "Add New Sheet Input Box")
Set NewSheet = Worksheets.Add
NewSheet.Name = MyValue
oldsheet.Rows("2:2").Copy Destination:=ActiveSheet.Range("A2")
End Sub


Gord Dibben MS Excel MVP

On Thu, 18 Dec 2008 20:04:01 -0800, celio3c
wrote:

Hi there!
I have the code bellow that allow me to create and name the new wsheet,
now i need to copy what is in the row 2 of the prior wsheet or any sheet,
because all sheets have the same header.

apreciate all the help.

thanks

celio3c


Public Sub newWsheet()
Dim Message, Title, Default, MyValue
Message = "Enter a name for the new Worksheet" ' Set prompt.
Title = "Add New sheet Input Box" '
Set title.
Default = "Give me a Name" '
Set default.
MyValue = InputBox(Message, Title, Default) '
'Display message, title, and default value.

Set NewSheet = Worksheets.Add
NewSheet.Name = MyValue
cmbWsheet.AddItem MyValue

End Sub





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default copy row 2 of any wsheet to the new crated wsheet

Sub addsheet()
Set oldsheet = ActiveSheet
On Error GoTo oops
MyValue = InputBox("Enter a name", "Add New Sheet Input Box")
Worksheets.Add.Name = MyValue
oldsheet.Rows("2:2").Copy Destination:=ActiveSheet.Range("A2")
Exit Sub
oops:
MsgBox "Sheet name already exists. Try again"
End Sub


Gord

On Fri, 19 Dec 2008 18:42:04 -0800, celio3c
wrote:

Thanks Socko and Gord

it did worked, perhaps i need a litle more to cover the situation, what if
the name entered already exist, i'm getting a error on that.


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default copy row 2 of any wsheet to the new crated wsheet

once more thank you very much, nicely done gorb.
--
celio3c



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
Data from 3 wsheets into billing invoice wsheet dbjSST Excel Worksheet Functions 3 October 20th 07 12:00 AM
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
I copy a formula and the results copy from the original cell brooklynsd Excel Discussion (Misc queries) 1 June 23rd 07 01:35 AM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM


All times are GMT +1. The time now is 09:05 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"