Copy, paste, then sort using VBA

Burrgogi

Active Member
Joined
Nov 3, 2005
Messages
263
Office Version
  1. 2010
Platform
  1. Windows
Every once in a while Fanatical (website) runs a bundle sale. It's listed in this format:

sample sale.png
When I copy & paste this manually into Excel, (Ctrl + C, then Ctrl + V), it looks just fine. See 2nd screenshot. I tried to write up a quick VBA solution to this repetitive process and I've run into a slight problem. The VBA routine tries to cram everything into cell A1 which is incorrect. I'm not versed enough with VBA to correct this problem. Also if someone can help me sort the table from highest to lowest using the Steam user rating column shown in percentage, I'd really appreciate it! EDIT: I know how to sort in Excel, I'm asking how to incorporate that into my current VBA routine.

Here's my code:
VBA Code:
Sub Paste_newSale()
   Sheets("Sheet").Copy , Sheets(Sheets.Count)
   ActiveSheet.Name = Format(Date, "dd_mm_yyyy")
Dim DataObj As MSForms.DataObject
Set DataObj = New MSForms.DataObject
DataObj.GetFromClipboard
SText = DataObj.GetText(1)
ActiveSheet.Range("A2").Value = SText
End Sub

Excel copy_paste_probllem B.png
 

Burrgogi

Active Member
Joined
Nov 3, 2005
Messages
263
Office Version
  1. 2010
Platform
  1. Windows
We have a winner ‼ Same player read again post #6 but well this time as never the workbook module was stated​
but the worksheet module …

So each time I want to do the same, I need to insert a new worksheet in my workbook and save your code there? Unless I've misunderstood something, this seems a bit awkward to do.....
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Marc L

Well-known Member
Joined
Apr 5, 2021
Messages
1,148
Office Version
  1. 2010
Platform
  1. Windows
Well read as I never stated each time ! Again the code just must be pasted in the destination / result worksheet.​
Once pasted it will stay in place if only the workbook is saved as macro (.xlsm) or better as binary format (.xlsb) …​
 

Burrgogi

Active Member
Joined
Nov 3, 2005
Messages
263
Office Version
  1. 2010
Platform
  1. Windows
Well read as I never stated each time ! Again the code just must be pasted in the destination / result worksheet.​
Once pasted it will stay in place if only the workbook is saved as macro (.xlsm) or better as binary format (.xlsb) …​

That is not the solution I was looking for but I appreciate your efforts.
 

Marc L

Well-known Member
Joined
Apr 5, 2021
Messages
1,148
Office Version
  1. 2010
Platform
  1. Windows
Explain at least what you are looking for !​
 

Forum statistics

Threads
1,137,154
Messages
5,679,908
Members
419,862
Latest member
Bluewings666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top