ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro newbie (https://www.excelbanter.com/excel-programming/316557-macro-newbie.html)

VB Newbie

Macro newbie
 
Hi folks-

I have two sheets in my workbook: Data and Table. I would like to compile a
table based on my 5-cell range (A1:E1) in my Data sheet. However, I need
this data to appear in the next available cell in Column B on my Table sheet.
I've tried looking at previous responses to this similar question and have
failed miserably in an attempt to try to work this properly. Here is what I
have thus far:

Sub test1()

Sheets("Data").Select
Range("A1:E1").Select
Selection.Copy
Sheets("Table").Select
Range("B10").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End Sub

Thank you for sharing your VB knowledge with me.
Sincerely,
Joe


Jack Schitt

Macro newbie
 
"VB Newbie" <VB wrote in message
...
Hi folks-

I have two sheets in my workbook: Data and Table. I would like to compile
a
table based on my 5-cell range (A1:E1) in my Data sheet. However, I need
this data to appear in the next available cell in Column B on my Table
sheet.
I've tried looking at previous responses to this similar question and have
failed miserably in an attempt to try to work this properly. Here is what
I
have thus far:

Sub test1()

Sheets("Data").Select
Range("A1:E1").Select
Selection.Copy
Sheets("Table").Select
Range("B10").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
End Sub

Thank you for sharing your VB knowledge with me.
Sincerely,
Joe


A couple of possibilities:

Option Explicit

Sub MyCopy1()
Dim rCell As Range
With Application
With .ThisWorkbook
Set rCell = .Worksheets("Table").Range("B65536").End(xlUp).Off set(1, 0)
..Worksheets("Data").Range("A1:E1").Copy
rCell.PasteSpecial Paste:=xlValues
End With '.Thisworkbook
..CutCopyMode = False
End With 'Application
End Sub 'MyCopy1()

Sub MyCopy2()
Dim rCell As Range
Dim rSource As Range
With Application.ThisWorkbook
Set rCell = .Worksheets("Table").Range("B65536").End(xlUp).Off set(1,
0).Resize(1, 5)
rCell.Value = .Worksheets("Data").Range("A1:E1").Value
End With 'Application.ThisWorkbook
End Sub 'MyCopy2()

--
Return email address is not as DEEP as it appears



Sharad Naik

Macro newbie
 
What to you mean by next available cell in Column B?
Do you mean the first available empty cell in coloumn B?

Sharad

"VB Newbie" <VB wrote in message
...
Hi folks-

I have two sheets in my workbook: Data and Table. I would like to compile
a
table based on my 5-cell range (A1:E1) in my Data sheet. However, I need
this data to appear in the next available cell in Column B on my Table
sheet.
I've tried looking at previous responses to this similar question and have
failed miserably in an attempt to try to work this properly. Here is what
I
have thus far:

Sub test1()

Sheets("Data").Select
Range("A1:E1").Select
Selection.Copy
Sheets("Table").Select
Range("B10").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
End Sub

Thank you for sharing your VB knowledge with me.
Sincerely,
Joe




Jack Schitt

Macro newbie
 
Forget the irrelevant "Dim rSource as Range" line, of course

--
Return email address is not as DEEP as it appears
"Jack Schitt" wrote in message
...
"VB Newbie" <VB wrote in message
...
Hi folks-

I have two sheets in my workbook: Data and Table. I would like to
compile a
table based on my 5-cell range (A1:E1) in my Data sheet. However, I need
this data to appear in the next available cell in Column B on my Table
sheet.
I've tried looking at previous responses to this similar question and
have
failed miserably in an attempt to try to work this properly. Here is
what I
have thus far:

Sub test1()

Sheets("Data").Select
Range("A1:E1").Select
Selection.Copy
Sheets("Table").Select
Range("B10").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

Thank you for sharing your VB knowledge with me.
Sincerely,
Joe


A couple of possibilities:

Option Explicit

Sub MyCopy1()
Dim rCell As Range
With Application
With .ThisWorkbook
Set rCell = .Worksheets("Table").Range("B65536").End(xlUp).Off set(1, 0)
.Worksheets("Data").Range("A1:E1").Copy
rCell.PasteSpecial Paste:=xlValues
End With '.Thisworkbook
.CutCopyMode = False
End With 'Application
End Sub 'MyCopy1()

Sub MyCopy2()
Dim rCell As Range
Dim rSource As Range
With Application.ThisWorkbook
Set rCell = .Worksheets("Table").Range("B65536").End(xlUp).Off set(1,
0).Resize(1, 5)
rCell.Value = .Worksheets("Data").Range("A1:E1").Value
End With 'Application.ThisWorkbook
End Sub 'MyCopy2()

--
Return email address is not as DEEP as it appears





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

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