ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   My VBA Script (https://www.excelbanter.com/excel-programming/392418-my-vba-script.html)

[email protected]

My VBA Script
 
this is the base of my script so far

Sub PasteSpecial()
Dim DeleteRows As Range
Range("A1:A3").Copy
Range("C4").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

Set DeleteRows = Range("A1:A8") ' this deletes the row that I just
copied. i.e. cut
DeleteRows.Delete Shift:=xlShiftUp
End Sub

This works great but it will overlap, paste over paste, becuase I have
the second range set to C4.

I want some how for the C4 to change after every copy so it would be
like this...
Range("A1:A3").Copy
Range("C4").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

Range("A1:A3").Copy
Range("C5").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

Range("A1:A3").Copy
Range("C6").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True


joel

My VBA Script
 
I think part of your problem maybe you are not deleting and adding the entire
row. Try adding .entirerow where appropriate. I can't tell from you code if
you want to only inserting certain columns or all columns (entirerow).

" wrote:

this is the base of my script so far

Sub PasteSpecial()
Dim DeleteRows As Range
Range("A1:A3").Copy
Range("C4").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

Set DeleteRows = Range("A1:A8") ' this deletes the row that I just
copied. i.e. cut
DeleteRows.Delete Shift:=xlShiftUp
End Sub

This works great but it will overlap, paste over paste, becuase I have
the second range set to C4.

I want some how for the C4 to change after every copy so it would be
like this...
Range("A1:A3").Copy
Range("C4").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

Range("A1:A3").Copy
Range("C5").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

Range("A1:A3").Copy
Range("C6").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True



Don Guillett

My VBA Script
 
I old and easily confused. If you want cells(a1:a3)transposed to c4:c6
a
b
c
a b c
a b c
a b c
Sub repeatcopy()
Range("A1:A3").Copy
Range("C4:c6").PasteSpecial Paste:=xlPasteValues, Transpose:=True
End Sub
But what do you want to delete?
A full explanation may be needed?

Don Guillett
SalesAid Software

wrote in message
ups.com...
this is the base of my script so far

Sub PasteSpecial()
Dim DeleteRows As Range
Range("A1:A3").Copy
Range("C4").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

Set DeleteRows = Range("A1:A8") ' this deletes the row that I just
copied. i.e. cut
DeleteRows.Delete Shift:=xlShiftUp
End Sub

This works great but it will overlap, paste over paste, becuase I have
the second range set to C4.

I want some how for the C4 to change after every copy so it would be
like this...
Range("A1:A3").Copy
Range("C4").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

Range("A1:A3").Copy
Range("C5").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

Range("A1:A3").Copy
Range("C6").Select ' This is the problem
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True




All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com