Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Exclamation How to copy selected column to another page under a specifik field?

Hi.
How do you make a macro that copies the selected column to another sheet/page in the same file, the contents of the selected column will go in specifically for a column where a WEEKNUM be indicated. Thus, the column is selected, the user presses for x a button where macro is run, the user will be asked, for example, through a dialog box (To which WEEKNUM want to copy the column to?). User types such as 23, and click OK. 23 is actually located in as: Y:2 in another page. The column to be copied must therefore fall directly under Y:3

(The dialogbox isnt important, the user could type the weeknum elsewhere).
Someone who can help me?
Attached Files
File Type: zip helpme.zip (9.3 KB, 68 views)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default How to copy selected column to another page under a specifik field?

Hi,

Am Mon, 4 Jun 2012 18:02:58 +0000 schrieb robissme:

How do you make a macro that copies the selected column to another
sheet/page in the same file, the contents of the selected column will go
in specifically for a column where a WEEKNUM be indicated. Thus, the
column is selected, the user presses for x a button where macro is run,
the user will be asked, for example, through a dialog box (To which
WEEKNUM want to copy the column to?). User types such as 23, and click
OK. 23 is actually located in as: Y:2 in another page. The column to be
copied must therefore fall directly under Y:3

(The dialogbox isnt important, the user could type the weeknum
elsewhere).
Someone who can help me?


try:

Sub myCopy()
Dim LRow As Long
Dim Answer As Integer

LRow = Sheets("Selected").Cells(Rows.Count, 1).End(xlUp).Row
Answer = Application.InputBox("Which weeknum is the destination?", _
Type:=1) 'enter only a number

If Answer = 0 Then
MsgBox "Please enter a weeknum"
Exit Sub
End If

Sheets("Selected").Range("A1:A" & LRow).Copy _
Destination:=Sheets("Copy-to").Cells(4, Answer)
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default How to copy selected column to another page under a specifik field?

The following subroutine will do the task. It also checks to see if
the week is between 1 and 52

Sub CopyColumn()
Dim C As Integer
Do
C = Application.InputBox(prompt:="Enter the week number",
Type:=1)
If C = False Then Exit Sub
If C = 1 And C <= 52 Then Exit Do
Loop

ActiveCell.EntireColumn.Copy Sheets("sheet2").Columns(C)

End Sub

Robert Flanagan
Add-ins.com LLC
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, fax 302-234-9859
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


On Jun 4, 2:02*pm, robissme wrote:
Hi.
How do you make a macro that copies the selected column to another
sheet/page in the same file, the contents of the selected column will go
in specifically for a column where a WEEKNUM be indicated. Thus, the
column is selected, the user presses for x a button where macro is run,
the user will be asked, for example, through a dialog box (To which
WEEKNUM want to copy the column to?). User types such as 23, and click
OK. 23 is actually located in as: Y:2 in another page. The column to be
copied must therefore fall directly under Y:3

(The dialogbox isnt important, the user could type the weeknum
elsewhere).
Someone who can help me?

+-------------------------------------------------------------------+
|Filename: helpme.zip * * * * * * * * * * * * * * * * * * * * * * * |
|Download:http://www.excelbanter.com/attachment.php?attachmentid=399|
+-------------------------------------------------------------------+

--
robissme


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
Reading field values selected by a Page variable Mark Parent Excel Programming 0 July 23rd 08 09:13 PM
Check if specifik folder exist. HH[_2_] Excel Programming 4 December 5th 06 09:11 AM
Summin Pivot Table data from a date selected in the Page field John Excel Discussion (Misc queries) 1 November 10th 06 10:32 PM
Macro, Copy Selected Cells Down a Column DB33 Excel Discussion (Misc queries) 9 February 15th 06 09:29 PM
Copy selected cell in column and fill in blanks Bluestar Excel Programming 2 June 15th 05 03:28 PM


All times are GMT +1. The time now is 12:46 PM.

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

About Us

"It's about Microsoft Excel"