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

Hi,

I'm new to VB programming but I'm sure that what I want to do is quite
simple. I have a 2 spreadsheets with 30,000 rows each. Every 12th row
has a number in it which I would like to put into the above 11 cells
automatically. I can use AutoFill for this, but this will result in
over 5,0000 operations. Can anyone give me any pointers as to how I
would go about writing a macro for this?

My initial guess is that I will need to use a FOR loop/AutoFill
feature but thats about it.

Any help would be appreciated.

Andrew
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel AutoFill

Assume the cells are blank
first blank cell is A1, column to work on is column A

Dim rng as Range, ar as Range
set rng = Columns(1).Specialcells(xlblanks)
for each ar in rng.Areas
ar.value = ar.offset(1,0)(1).Value
Next


Test on a copy of your workbook.

--
Regards,
Tom Ogilvy


"Andrew" wrote in message
om...
Hi,

I'm new to VB programming but I'm sure that what I want to do is quite
simple. I have a 2 spreadsheets with 30,000 rows each. Every 12th row
has a number in it which I would like to put into the above 11 cells
automatically. I can use AutoFill for this, but this will result in
over 5,0000 operations. Can anyone give me any pointers as to how I
would go about writing a macro for this?

My initial guess is that I will need to use a FOR loop/AutoFill
feature but thats about it.

Any help would be appreciated.

Andrew



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel AutoFill

Hi Tom,

Thanks for the swift reply. I have tried your suggestion, but nothing
seems to happen??? I am also wondering if I haven't explained the
scenario very well. I have put a screenshot online to help anyone that
has any suggestions.

Screenshots: http://www.slc.auckland.ac.nz/excelexample/

Regards,
Andrew





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Excel AutoFill

Hi Andrew,

Amending, to operate on Column B , and correcting a minor typo in the
offset, Tom's code works for me and reads:

Dim rng As Range, ar As Range

Set rng = Columns(2).SpecialCells(xlBlanks)
For Each ar In rng.Areas
ar.Value = ar.Offset(1, 0)(11).Value
Next

---
Regards,
Norman

"Andrew Lavery" wrote in message
...
Hi Tom,

Thanks for the swift reply. I have tried your suggestion, but nothing
seems to happen??? I am also wondering if I haven't explained the
scenario very well. I have put a screenshot online to help anyone that
has any suggestions.

Screenshots: http://www.slc.auckland.ac.nz/excelexample/

Regards,
Andrew





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel AutoFill

Actually, as intended it should have been

Sub AAA()
Set rng = Columns(2).SpecialCells(xlBlanks)
For Each ar In rng.Areas
ar.Value = ar.Offset(11, 0)(1).Value
Next

End Sub

But I like your idea better, so it could be:

Sub AAB()
Set rng = Columns(2).SpecialCells(xlBlanks)
For Each ar In rng.Areas
ar.Value = ar(12).Value
Next

--
Regards,
Tom Ogilvy

"Norman Jones" wrote in message
...
Hi Andrew,

Amending, to operate on Column B , and correcting a minor typo in the
offset, Tom's code works for me and reads:

Dim rng As Range, ar As Range

Set rng = Columns(2).SpecialCells(xlBlanks)
For Each ar In rng.Areas
ar.Value = ar.Offset(1, 0)(11).Value
Next

---
Regards,
Norman

"Andrew Lavery" wrote in message
...
Hi Tom,

Thanks for the swift reply. I have tried your suggestion, but nothing
seems to happen??? I am also wondering if I haven't explained the
scenario very well. I have put a screenshot online to help anyone that
has any suggestions.

Screenshots: http://www.slc.auckland.ac.nz/excelexample/

Regards,
Andrew





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





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
Why doesn't autofill work in Excel? trainer07 Excel Discussion (Misc queries) 1 July 19th 07 08:47 PM
Autofill - Excel Chris Excel Worksheet Functions 7 April 24th 07 08:03 PM
How can I get excel to autofill the next column? jayman Excel Discussion (Misc queries) 2 May 27th 06 08:47 PM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Excel Discussion (Misc queries) 1 June 17th 05 08:21 PM
Need help with excel autofill VBA style William Whitlam via OfficeKB.com New Users to Excel 3 April 29th 05 09:03 AM


All times are GMT +1. The time now is 06:52 AM.

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"