Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default change of data location

unable to macro, can anybody help please
I have bunch ofdata in Excel and want:
1- to insert an empty cell in Col G start from G4, (G4 content goes one cell
down etc) jump evrery 8 cell, (e.g. G12, G20 ,... up to G49181 as last cell.

2- copy data from T3 to G4, T12 to G13, T21 to G22 and continue by jumping
for both T and G as 9. Last cell to copy from is T49180 and copy to G49181.

Appreciate your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default change of data location

Darius

The key to the solving your problem seems to be to select every 8th row;
insert row, select every eighth row again; copy values from row T.

1) This Microsoft code should get you started selecting rows:
http://support.microsoft.com/kb/213438

Change RowsBetween = 3
To RowsBetween = 8


You will need to modify the code so it selects ranges for insert and copy as
you specify below. If you work with the selection range as a parameter, you
can re-use the same code for both part of the selection process. In other
words, the code will start as follows:

Sub SelectEveryNthRow(yourRange)
' any Dim statements
Range(yourRange).Select
' Initialize ColsSelection equal to the number of columns in the
' selection.
' etc

2) Record a macro to cover insert row. If you record an insert for a single
cell (say G4) it will also work on non-contiguous multi-cell selection,
provided you only use the code specific to row insertion. For example, if
you happen to record Range("G4").select (or similar) delete this from the
recording.

3) To copy your values from column T (OTOMH and untested)

Sub CopyTvalsToG()
'use after selecting blanks in row G
'in the following -1 is previous row
' 13 is 13 columns across
selection.value = selection.offset(-1,13).value
End Sub

Note: The Microsoft code loops through cells and will be v-e-r-y s-l-o-w.
So, you will need to be very patient:-(
To speed things up a little, turn off screen updating and set calculations
to manual. After the code runs, turn screen updating back on and rest
calculations to previous value.

To speed up testing, work with a smaller range of test data.

Hopefully, you understand a little VBA coding and will be able to read what
the Microsoft code does as you step through its execution and look at the
result. If you do need help doing any of the above, please ask.

--
Steve

"Darius" wrote in message
...
unable to macro, can anybody help please
I have bunch ofdata in Excel and want:
1- to insert an empty cell in Col G start from G4, (G4 content goes one
cell
down etc) jump evrery 8 cell, (e.g. G12, G20 ,... up to G49181 as last
cell.

2- copy data from T3 to G4, T12 to G13, T21 to G22 and continue by jumping
for both T and G as 9. Last cell to copy from is T49180 and copy to
G49181.

Appreciate your help


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
Change the location of external data feeding a pivottable Mark Parent Excel Discussion (Misc queries) 4 January 3rd 08 10:20 PM
Change Location of VBE References with VBA Peter T Excel Programming 4 July 24th 07 04:31 PM
How do I change the default location when Importing data? Hyerczyk Excel Discussion (Misc queries) 3 July 7th 06 05:53 PM
sort multiple columns of data but not change the data location... Possible? [email protected] Excel Programming 3 June 15th 06 09:15 PM


All times are GMT +1. The time now is 08:58 AM.

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"