Transpose from 1 sheet to another

Babynod

Board Regular
Joined
Aug 10, 2022
Messages
56
Office Version
  1. 365
Platform
  1. Windows
Hi All,

i am looking to make a laptop register for work,

what i want is to past the laptop specs into a sheet and hit the cmdbutton. this will then transpose it from vertical to horizontal. i need it to enter into sheet2 on the next row down. at the moment i can only get it to overwrite the cell i defined, not the next empty one.

this is an example of the data i will be entering. i will be transposing the right column, not the headers on the left
OS NameMicrosoft Windows 11
Version10.0.22000 Build 22000
Other OS DescriptionNot Available
OS ManufacturerMicrosoft Corporation
System NameTULLAP008
System ManufacturerHP
System ModelHP EliteBook 840 G5
System Typex64-based PC
System SKU3TU06PA#ABG
ProcessorIntel(R) Core(TM) i5-8350U CPU @ 1.70GHz, 1896 Mhz, 4 Core(s), 8 Logical Processor(s)
BIOS Version/DateHP Q78 Ver. 01.18.01, 24/11/2021
SMBIOS Version
3.1​
Embedded Controller Version
4.109​
BIOS ModeUEFI
BaseBoard ManufacturerHP
BaseBoard Product83B2
BaseBoard VersionKBC Version 04.6D.00
Platform RoleMobile
Secure Boot StateOn
PCR7 ConfigurationElevation Required to View
Windows DirectoryC:\WINDOWS
System DirectoryC:\WINDOWS\system32
Boot Device\Device\HarddiskVolume2
LocaleUnited States
Hardware Abstraction LayerVersion = "10.0.22000.1"
User NameMAH\Mark
Time ZoneAUS Eastern Standard Time
Installed Physical Memory (RAM)8.00 GB
Total Physical Memory7.85 GB
Available Physical Memory847 MB
Total Virtual Memory17.3 GB
Available Virtual Memory6.43 GB
Page File Space9.50 GB
Page FileC:\pagefile.sys
Kernel DMA ProtectionOff
Virtualization-based securityNot enabled
Device Encryption SupportElevation Required to View
Hyper-V - VM Monitor Mode ExtensionsYes
Hyper-V - Second Level Address Translation ExtensionsYes
Hyper-V - Virtualization Enabled in FirmwareYes
Hyper-V - Data Execution ProtectionYes
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
To help we always need specific details.
You said:
specs into a sheet

What are the two sheet names

And you said:

"this is an example of the data i will be entering. i will be transposing the right column"

Right column??

We need column number like column G or column 7
 
Upvote 0
Assuming you want to paste it starting in column A on sheet2, try this:

VBA Code:
Sub LaptopRegisterTranspose()

    Dim srcSht As Worksheet, destSht As Worksheet
    Dim srcRng As Range, destRng As Range
    
    Set srcSht = Worksheets("Sheet1")
    Set destSht = Worksheets("Sheet2")
    With destSht
        Set destRng = .Range("A" & Rows.Count).End(xlUp).Offset(1)
    End With
    
    With srcSht
        Set srcRng = .Range("B1:B" & .Cells(Rows.Count, "B").End(xlUp).Row)
    End With
    
    srcRng.Copy
    destRng.PasteSpecial Paste:=xlPasteValues, Transpose:=True
    
    Application.CutCopyMode = False

End Sub
 
Upvote 0
Solution
Assuming you want to paste it starting in column A on sheet2, try this:

VBA Code:
Sub LaptopRegisterTranspose()

    Dim srcSht As Worksheet, destSht As Worksheet
    Dim srcRng As Range, destRng As Range
   
    Set srcSht = Worksheets("Sheet1")
    Set destSht = Worksheets("Sheet2")
    With destSht
        Set destRng = .Range("A" & Rows.Count).End(xlUp).Offset(1)
    End With
   
    With srcSht
        Set srcRng = .Range("B1:B" & .Cells(Rows.Count, "B").End(xlUp).Row)
    End With
   
    srcRng.Copy
    destRng.PasteSpecial Paste:=xlPasteValues, Transpose:=True
   
    Application.CutCopyMode = False

End Sub
this works great, the only thing ill want to change is this adds it to the bottom of my table on sheet2, i want it to start from the top of the table
 
Upvote 0
this works great, the only thing ill want to change is this adds it to the bottom of my table on sheet2, i want it to start from the top of the table
You're original text did say "the next empty one".

To put it in the first row we need more information.
• What row are your headings on in Sheet2 ?
• When you say your "table" is that an actual Excel Table and if so what is the name of the Table ?
• Is there anything to the right of the table, ie can we insert a full row or does the insertion need to stay within the table boundaries ?
 
Upvote 0
You're original text did say "the next empty one".

To put it in the first row we need more information.
• What row are your headings on in Sheet2 ?
• When you say your "table" is that an actual Excel Table and if so what is the name of the Table ?
• Is there anything to the right of the table, ie can we insert a full row or does the insertion need to stay within the table boundaries ?
Hi Alex,

i think it was taking the premade table (from format as table button) as a full cell and was inserting the data below that, i ended up deleting all the rows of the table except the first one and now its entering the data right.

sheet1 = Data Entry
sheet2 = Database
theres nothing to the right of the table

1662079961436.png


ive setup a custom sort on column F to sort A-Z which works now if i prompt it manually, but when i try to prompt it on worksheet_change but it bugs out
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    ActiveSheet.AutoFilter.ApplyFilter

End Sub
1662080275235.png
1662080292973.png
 
Upvote 0
If we you are happy you have a fix for the original subject of this thread, you will need to start a new thread for the new question. It is a very different subject.

When you create the new thread you need to clarify what you are trying to do. Your text refers to a "Sort" but your code refers to a "Filter".
Also I can't imagine that you want it to run it everytime someone makes any kind of change to the spreadsheet.
I think you need to save your sort list somewhere on the spreadsheet and that it needs to be reapplied each time you run it but if you start a new thread others may be able to give you other options.
 
Upvote 0
If we you are happy you have a fix for the original subject of this thread, you will need to start a new thread for the new question. It is a very different subject.

When you create the new thread you need to clarify what you are trying to do. Your text refers to a "Sort" but your code refers to a "Filter".
Also I can't imagine that you want it to run it everytime someone makes any kind of change to the spreadsheet.
I think you need to save your sort list somewhere on the spreadsheet and that it needs to be reapplied each time you run it but if you start a new thread others may be able to give you other options.
ok thanks for the tips alex
 
Upvote 0

Forum statistics

Threads
1,224,874
Messages
6,181,511
Members
453,049
Latest member
amirrznjd

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
Back
Top