Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default newbie question

I am trying to get an input box that will tell what cell I want it to copy
paste information in. I have it to where it will pick the cell, but it won't
do the second half that I need it to do. I know it shouldn't be this hard,
but for me it is today.
Any help would be greatly appreciated.

'
' Update_Agents Macro
' Macro recorded 4/9/2007 by aemmi
'

'
Range("B39:P39").Select
Selection.Copy
Range("B27").Select <this is where I need to be able to change the cell
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default newbie question

So you're always copying from B39:P39?

Dim RngToCopy as range
dim DestCell as range

with activesheet
set rngtocopy = .range("B39:p39")

set destcell = nothing
on error resume next
set destcell = application.inputbox(Prompt:="select a cell",type:=8).cells(1)
on error goto 0

if destcell is nothing then
exit sub 'user hit cancel
end if
End with

with destcell.resize(rngtocopy.rows.count,rngtocopy.col umns.count)
.value = rngtocopy.value
With .font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
end with
End With



wrote:

I am trying to get an input box that will tell what cell I want it to copy
paste information in. I have it to where it will pick the cell, but it won't
do the second half that I need it to do. I know it shouldn't be this hard,
but for me it is today.
Any help would be greatly appreciated.

'
' Update_Agents Macro
' Macro recorded 4/9/2007 by aemmi
'

'
Range("B39:P39").Select
Selection.Copy
Range("B27").Select <this is where I need to be able to change the cell
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
End Sub


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default newbie question

Application.Inputbox may be what you are looking for. Change the variable
rngSource to the appropriate worksheet and watch for the word wrap the that
will undoubtedly occur when I post this macro to the newsgroup.


Sub test()
Dim rngSource As Range
Dim rngDest As Range

Set rngSource = Worksheets("Sheet1").Range("B39:P39") '<<CHANGE

On Error Resume Next
Set rngDest = Application.InputBox("Select Destination", Type:=8)
On Error GoTo 0

If rngDest Is Nothing Then Exit Sub

rngSource.Copy
With rngDest.Cells(1).Resize(rngSource.Rows.Count, rngSource.Columns.Count)
.PasteSpecial _
Paste:=xlPasteValues, _
Operation:=xlNone, _
skipBlanks:=False, _
Transpose:=False
Application.CutCopyMode = False
With .Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
End With
End Sub



" wrote:

I am trying to get an input box that will tell what cell I want it to copy
paste information in. I have it to where it will pick the cell, but it won't
do the second half that I need it to do. I know it shouldn't be this hard,
but for me it is today.
Any help would be greatly appreciated.

'
' Update_Agents Macro
' Macro recorded 4/9/2007 by aemmi
'

'
Range("B39:P39").Select
Selection.Copy
Range("B27").Select <this is where I need to be able to change the cell
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default newbie question

This is perfect Thank YOU!

As for your question, the reason I am always coping from B39:p39 is there is
a series of formulas there that gets the information they need for a report.
Again Thank you so very much Dave!

"Dave Peterson" wrote:

So you're always copying from B39:P39?

Dim RngToCopy as range
dim DestCell as range

with activesheet
set rngtocopy = .range("B39:p39")

set destcell = nothing
on error resume next
set destcell = application.inputbox(Prompt:="select a cell",type:=8).cells(1)
on error goto 0

if destcell is nothing then
exit sub 'user hit cancel
end if
End with

with destcell.resize(rngtocopy.rows.count,rngtocopy.col umns.count)
.value = rngtocopy.value
With .font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
end with
End With



wrote:

I am trying to get an input box that will tell what cell I want it to copy
paste information in. I have it to where it will pick the cell, but it won't
do the second half that I need it to do. I know it shouldn't be this hard,
but for me it is today.
Any help would be greatly appreciated.

'
' Update_Agents Macro
' Macro recorded 4/9/2007 by aemmi
'

'
Range("B39:P39").Select
Selection.Copy
Range("B27").Select <this is where I need to be able to change the cell
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
End Sub


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default newbie question

Glad I could help.

If you ever decide that you want to allow the user to pick the cells to copy,
you could tell them to select the range first and use that Selection--or just
ask for the range with a different application.inputbox.

wrote:

This is perfect Thank YOU!

As for your question, the reason I am always coping from B39:p39 is there is
a series of formulas there that gets the information they need for a report.
Again Thank you so very much Dave!

"Dave Peterson" wrote:

So you're always copying from B39:P39?

Dim RngToCopy as range
dim DestCell as range

with activesheet
set rngtocopy = .range("B39:p39")

set destcell = nothing
on error resume next
set destcell = application.inputbox(Prompt:="select a cell",type:=8).cells(1)
on error goto 0

if destcell is nothing then
exit sub 'user hit cancel
end if
End with

with destcell.resize(rngtocopy.rows.count,rngtocopy.col umns.count)
.value = rngtocopy.value
With .font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
end with
End With



wrote:

I am trying to get an input box that will tell what cell I want it to copy
paste information in. I have it to where it will pick the cell, but it won't
do the second half that I need it to do. I know it shouldn't be this hard,
but for me it is today.
Any help would be greatly appreciated.

'
' Update_Agents Macro
' Macro recorded 4/9/2007 by aemmi
'

'
Range("B39:P39").Select
Selection.Copy
Range("B27").Select <this is where I need to be able to change the cell
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
End Sub


--

Dave Peterson


--

Dave Peterson
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
Newbie Question Francis Whitaker New Users to Excel 4 March 14th 08 10:26 PM
Real Newbie newbie question Dave New Users to Excel 0 January 10th 07 07:55 PM
If Then Question from Newbie. . . hospitalgreg Excel Discussion (Misc queries) 6 October 16th 06 08:16 PM
Newbie question Barry Clark[_2_] Excel Programming 10 June 12th 06 08:40 PM
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM


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

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"