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

ok, here's what i got.

this subscript basically takes data from one sheet and pastes it t
another sheet.
However, it keeps overwriting the first block in cell in the new shee
"A1" How do i get it to drop down after the first loop to b1...the
c1...then d1 etc. etc.


Thanks...here is my code..

V/R

Jody


Sub transpose()
'
'
'Loop for Transposing Pivot Table to create spreadsheet for VLOOKUP
ActiveSheet.Select
Range("A5").Select

Do While ActiveCell.Value < ""
Selection.Copy
Sheets("Sheet3").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("Sheet4").Select

ActiveCell.Offset(0, 2).Select

Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(11, 0)).Select
Selection.Copy
Sheets("Sheet3").Select

Range("a1").Select 'I know this is where my code is?

ActiveCell.Offset(0, 1).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:=False _
, transpose:=True
Sheets("Sheet4").Select
ActiveCell.Offset(0, 1).Select
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(11, 0)).Select
Selection.Copy
Sheets("Sheet3").Select
ActiveCell.Offset(0, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:=False _
, transpose:=True
Sheets("Sheet4").Select
ActiveCell.Offset(0, 1).Select
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(11, 0)).Select
Selection.Copy
Sheets("Sheet3").Select
ActiveCell.Offset(0, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:=False _
, transpose:=True
ActiveCell.Select
ActiveCell.Offset(1, -25).Select
Sheets("Sheet4").Select
ActiveCell.Offset(12, -4).Select
Loo

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Probelme with coding...

Hi Jody,

Try banishing all the selects. You virtually never need to .Select anything
in order to use it. This little code snippet copies all non-blank cells
from A1:A20 into a contiguous range in another sheet. Perhaps it will give
you some ideas:

Sub A()
Dim rngSrc As Range, rngDest As Range

Set rngSrc = ThisWorkbook.Worksheets(1).Range("A1")
Set rngDest = ThisWorkbook.Worksheets(2).Range("A1")

Do While rngSrc.Row <= 20
If Not IsEmpty(rngSrc.Value) Then
rngDest.Value = rngSrc.Value
Set rngDest = rngDest.Offset(1, 0)
End If
Set rngSrc = rngSrc.Offset(1, 0)
Loop
End Sub

HTH

Peter Beach

"jody.mckinzie " wrote in
message ...
ok, here's what i got.

this subscript basically takes data from one sheet and pastes it to
another sheet.
However, it keeps overwriting the first block in cell in the new sheet
"A1" How do i get it to drop down after the first loop to b1...then
c1...then d1 etc. etc.


Thanks...here is my code..

V/R

Jody


Sub transpose()
'
'
'Loop for Transposing Pivot Table to create spreadsheet for VLOOKUP
ActiveSheet.Select
Range("A5").Select

Do While ActiveCell.Value < ""
Selection.Copy
Sheets("Sheet3").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("Sheet4").Select

ActiveCell.Offset(0, 2).Select

Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(11, 0)).Select
Selection.Copy
Sheets("Sheet3").Select

Range("a1").Select 'I know this is where my code is?

ActiveCell.Offset(0, 1).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=False _
, transpose:=True
Sheets("Sheet4").Select
ActiveCell.Offset(0, 1).Select
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(11, 0)).Select
Selection.Copy
Sheets("Sheet3").Select
ActiveCell.Offset(0, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=False _
, transpose:=True
Sheets("Sheet4").Select
ActiveCell.Offset(0, 1).Select
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(11, 0)).Select
Selection.Copy
Sheets("Sheet3").Select
ActiveCell.Offset(0, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=False _
, transpose:=True
ActiveCell.Select
ActiveCell.Offset(1, -25).Select
Sheets("Sheet4").Select
ActiveCell.Offset(12, -4).Select
Loop


---
Message posted from http://www.ExcelForum.com/



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
Need help with coding anna New Users to Excel 4 April 24th 08 05:06 AM
sum by coding without 0 kaja New Users to Excel 2 March 1st 08 03:52 PM
How to fix the coding? Eric Excel Worksheet Functions 0 February 26th 08 03:38 AM
How to fix the coding? Eric Excel Worksheet Functions 4 June 20th 07 02:42 PM
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? StargateFan[_3_] Excel Programming 10 October 6th 05 01:18 PM


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