streetshark
New Member
- Joined
- May 2, 2022
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hello,
I have a big database with over 500 rows of objects and over 44 columns. The purpose is to select some of the objects(most of the time 7-10 objects/rows) and copy data of the 12 needed columns(12) to the existing powerpoint table for comparison. I would like to create a macro to speed up the process and dont need to copy every column by hand.
Step for Step
1. select objects(rows) /mark cell with an x (i have a code to scan the column for x)
2. press macro button
3. the data of the selected objects/rows should be copied/ reordered into an existing power point table.
I am new to VBA and i would appreciate any help.
this is my code so far to reorder the table in excel but i dont know how copy jsut the columns i need.
Dim ws1 As Worksheet, ws2 As Worksheet
Dim Myarray As Variant
Dim lastRow As Integer, LastColumn As Integer
Dim StartCells As Range
'set the data/worksheets(where is it from)
Set ws1 = ThisWorkbook.Sheets("Sheet1")
Google
Set ws2 = ThisWorkbook.Sheets("Sheet2")
Set StartCell = ws1.Range("A1")
lastRow = ws1.Cells(ws1.Rows.Count, StartCell.Column).End(xlUp).Row 'last row code
LastColumn = ws1.Cells(StartCell.Row, ws1.Columns.Count).End(xlToLeft).Column
Myarray = ws1.Range(StartCell, ws1.Cells(lastRow, LastColumn)).Value2 ' define the array
Myarray = WorksheetFunction.Transpose(Myarray)
ws2.Range("a1", ws2.Cells(LastColumn, lastRow)).Value = Myarray
I have a big database with over 500 rows of objects and over 44 columns. The purpose is to select some of the objects(most of the time 7-10 objects/rows) and copy data of the 12 needed columns(12) to the existing powerpoint table for comparison. I would like to create a macro to speed up the process and dont need to copy every column by hand.
Step for Step
1. select objects(rows) /mark cell with an x (i have a code to scan the column for x)
2. press macro button
3. the data of the selected objects/rows should be copied/ reordered into an existing power point table.
I am new to VBA and i would appreciate any help.
this is my code so far to reorder the table in excel but i dont know how copy jsut the columns i need.
Dim ws1 As Worksheet, ws2 As Worksheet
Dim Myarray As Variant
Dim lastRow As Integer, LastColumn As Integer
Dim StartCells As Range
'set the data/worksheets(where is it from)
Set ws1 = ThisWorkbook.Sheets("Sheet1")
Set ws2 = ThisWorkbook.Sheets("Sheet2")
Set StartCell = ws1.Range("A1")
lastRow = ws1.Cells(ws1.Rows.Count, StartCell.Column).End(xlUp).Row 'last row code
LastColumn = ws1.Cells(StartCell.Row, ws1.Columns.Count).End(xlToLeft).Column
Myarray = ws1.Range(StartCell, ws1.Cells(lastRow, LastColumn)).Value2 ' define the array
Myarray = WorksheetFunction.Transpose(Myarray)
ws2.Range("a1", ws2.Cells(LastColumn, lastRow)).Value = Myarray