Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Macro to copy a cell contains formula to a range

Sub hfscopy()
'
' purpose is to copy cell AI4 to Range AI 8 upto AI filled in the message
box "copy to this row", but it stuck in .Range("AI4").Copy
Destination:=Range("AI8:AI & CopyToThisRow") with highlight in yelllow.

I appreciate for any help


Dim CopyToThisRow As Long
CopyToThisRow = InputBox("Isi disini.... sampai cell dari kolunm AI no
berapa?")
If IsNumeric(CopyToThisRow) Then
With Worksheets("PO_Line_text")
If CopyToThisRow 8 And CopyToThisRow <= .Rows.Count Then
.Range("AI4").Copy Destination:=Range("AI8:AI & CopyToThisRow")
.Range("AI8:AI" & CopyToThisRow).Select
Exit Sub
End If
End With
End If
MsgBox "Kamu tidak mengisi no cell yang benar"
End Sub

--
H. Frank Situmorang
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro to copy a cell contains formula to a range

Variable should not be inside strings with double quotes. fix thjis is two
places in the code.

from
"AI8:AI & CopyToThisRow"
to
"AI8:AI" & CopyToThisRow


"Frank Situmorang" wrote:

Sub hfscopy()
'
' purpose is to copy cell AI4 to Range AI 8 upto AI filled in the message
box "copy to this row", but it stuck in .Range("AI4").Copy
Destination:=Range("AI8:AI & CopyToThisRow") with highlight in yelllow.

I appreciate for any help


Dim CopyToThisRow As Long
CopyToThisRow = InputBox("Isi disini.... sampai cell dari kolunm AI no
berapa?")
If IsNumeric(CopyToThisRow) Then
With Worksheets("PO_Line_text")
If CopyToThisRow 8 And CopyToThisRow <= .Rows.Count Then
.Range("AI4").Copy Destination:=Range("AI8:AI & CopyToThisRow")
.Range("AI8:AI" & CopyToThisRow).Select
Exit Sub
End If
End With
End If
MsgBox "Kamu tidak mengisi no cell yang benar"
End Sub

--
H. Frank Situmorang

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Macro to copy a cell contains formula to a range

Thanks Joel, it works perfectly, you are awesome.

--
H. Frank Situmorang


"Joel" wrote:

Variable should not be inside strings with double quotes. fix thjis is two
places in the code.

from
"AI8:AI & CopyToThisRow"
to
"AI8:AI" & CopyToThisRow


"Frank Situmorang" wrote:

Sub hfscopy()
'
' purpose is to copy cell AI4 to Range AI 8 upto AI filled in the message
box "copy to this row", but it stuck in .Range("AI4").Copy
Destination:=Range("AI8:AI & CopyToThisRow") with highlight in yelllow.

I appreciate for any help


Dim CopyToThisRow As Long
CopyToThisRow = InputBox("Isi disini.... sampai cell dari kolunm AI no
berapa?")
If IsNumeric(CopyToThisRow) Then
With Worksheets("PO_Line_text")
If CopyToThisRow 8 And CopyToThisRow <= .Rows.Count Then
.Range("AI4").Copy Destination:=Range("AI8:AI & CopyToThisRow")
.Range("AI8:AI" & CopyToThisRow).Select
Exit Sub
End If
End With
End If
MsgBox "Kamu tidak mengisi no cell yang benar"
End Sub

--
H. Frank Situmorang

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
Macro to copy a certain a cell to a dynamic range Frank Situmorang[_2_] Excel Programming 5 March 14th 08 04:26 AM
Create Macro to copy a formula to range of cell summer Excel Programming 2 June 15th 07 04:52 AM
Help: Macro Copy Active Cell to Range Name, loop [email protected] Excel Programming 3 March 30th 07 08:25 PM
Macro Copy Active Cell to Range Name, loop zigstick Excel Programming 6 April 27th 05 07:55 PM
How to copy formula from one cell to a range? Jason Weiss Excel Programming 1 April 22nd 05 03:54 PM


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