Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Autocopy instead of autofill

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Basta1980 - 21 May 2008 11:10 GMT
Hi all,

I use this code to autofill a range.

Private Sub CommandButton1_Click()
'Macro_om_datum_te_genereren
Dim rng As Range
Set rng = ActiveSheet.Range("J9")

rng.AutoFill Range(rng, rng.Offset(0, -1).End(xlDown).Offset(0, 1))

End Sub

Things is, don't want VBA to fill but to copy the information. What small
modifcation needs to be done to get this code working?!

Regards

Sebastiaan
Joel - 21 May 2008 11:15 GMT
from
rng.AutoFill Range(rng, rng.Offset(0, -1).End(xlDown).Offset(0, 1))

to

rng.copy destination:=Range(rng, rng.Offset(0, -1).End(xlDown).Offset(0, 1))

> Hi all,
>
[quoted text clipped - 15 lines]
>
> Sebastiaan
Dave Peterson - 21 May 2008 12:42 GMT
.autofill has several parms that you can include.

I'd try:

rng.AutoFill _
  destination:=Range(rng, rng.Offset(0, -1).End(xlDown).Offset(0, 1)), _
  type:=xlFillCopy

> Hi all,
>
[quoted text clipped - 15 lines]
>
> Sebastiaan

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.