View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.misc
bioyyy bioyyy is offline
external usenet poster
 
Posts: 22
Default Need Major Help on the Macro

Per Jessen:

Work very nice. Thanks for all your help. You are my HERO. also, thanks to
Sheeloo. Your guys are great!




"Per Jessen" wrote:

Hi....

Thanks for your reply, try this:

Sub Help()
TargetCol = "Q"
DestRow = 26
DestCol = "AZ"

For TargetRow = 26 To 1000
CopyCols = Cells(TargetRow, TargetCol).Value
If CopyCols 0 Then
Range("V" & TargetRow).Resize(1, CopyCols).Copy
Sheets("Sheet1").Cells(DestRow, DestCol).PasteSpecial _
Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False, _
Transpose:=True
DestRow = DestRow + CopyCols + 2
End If
Next
Application.CutCopyMode = False
End Sub

BTW: You should always state the error description which you recive as
it's much eaysier to look for a error when you know what to look for.

Regards,
Per


On 24 Okt., 02:59, bioyyy wrote:
Per Jessen:
I just fixed a litle bit. Here how I did :

Sub Help()
TargetCol = "Q"
DestRow = 26
DestCol = "AZ"

For TargetRow = 26 To 1000
CopyCols = Cells(TargetRow, TargetCol).Value
Range("V" & TargetRow).Resize(1, CopyCols).Copy
Sheets("Sheet6").Cells(DestRow, DestCol).PasteSpecial Paste:=xlAll,
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
DestRow = DestRow + CopyCols + 2
Next
Application.CutCopyMode = False
End Sub

BUT there is a bug at line: Range("V" & TargetRow).Resize(1, CopyCols).Copy.
It 's in yellow. You can tell I don't know much about the code. Thanks again.



"Per Jessen" wrote:
Hi


Try to see if this is what you need:


Sub Help()
TargetCol = "Q"
DestRow = 26
DestCol = "AZ"


For TargetRow = 26 To 1000
CopyCols = Cells(TargetRow, TargetCol).Value
Range("V" & TargetRow).Resize(1, CopyCols).Copy
Sheets("Sheet1").Cells(DestRow, DestCol).PasteSpecial
Paste:=xlAll, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
DestRow = DestRow + CopyCols + 2
Next
Application.CutCopyMode = False
End Sub


Regards,
Per


On 24 Okt., 00:33, bioyyy wrote:
Hello:


I need your help desperately. Transpose the columns into rows with a
condition. For example,


Q R S T U V
X Y Z AA AB
Row 26 6 A1 B1 C1 D1 1:1 1:2
12:2
Row 27 5 B2 C1 -- -- --- --


So, here are the steps what I would like to you help me,


(1) if row 26, col Q has 6, copy 6 columns from V to AB (ie. # column copy =
number enter in row 26 col Q.
(2) Tranpose and put in col AZ, row 26 (starting on row 26)
(3) Skip 2 rows,
(4) then repeat for row 27. So, if row 27, col Q has 5, copy 5 columns from
V to AA. Tranpose, skip 2 rows and repeat that up to row 1000.


Your help is greatly appreciated.- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -