needing a macro to run this type of question "value in column (2 values: "s" or "l") COPIES values from the same row only column A and B info

khelp11

New Member
Joined
Mar 13, 2024
Messages
11
Office Version
  1. 2011
Platform
  1. Windows
i have never dealt with macros so I am just needing some help for this issue.

the value in this column (2 values: "s" or "i") COPIES (I do not want any information removed or moved from the original sheet) values from the same row but only values in column A and B info over to either sheet "Silent" or sheet "Live" .

I think I covered what I need. let me know if you need more info!

THANK YOU AND YOU GUYS ARE AMAZING!!!!!!!!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Welcome to the Board!

I think it would be very beneficial to us if you could show us a small example of your data and your expected output, as so much is dependent upon your data and data structure.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Auction Platform 1.xlsx
ABCD
1Item #Item DescriptionDonated byS or L
21earringsbug s
32necklacesusyl
43cowboy artcodys
54cartinas
65chair stevel
76frameclayl
87boardcoryl
98t-shirtkyles
109tanktopkryss
1110shoesdorothys
1211blue boardalanas
1312pink framekrysl
1413dressercodyl
1514elk hornsusyl
1615deer mounttinal
1716rugclays
1817buffalo hidecoryl
1918elk huntkyles
2019buffalo hunttinal
2120phonesteves
2221signbugl
Items
Cells with Data Validation
CellAllowCriteria
D1:D22List=$L$4:$L$5



Auction Platform 1.xlsx
ABCDE
1Item #Item DescriptionBuyerBidder #Winning Bid
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Silent




Auction Platform 1.xlsx
ABCDE
1Item #Item DescriptionBuyerBidder #Winning Bid
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Live



Auction Platform 1.xlsx
ABCDE
1Item #Item DescriptionBuyerBidder #Winning Bid
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Check out




I am wanting column d to be telling what information goes where. I want only column a and b information of each row go the correct sheet according to column d. I do not want any information moved, just copied over to the other two pages.

Then I want the information copied from sheets Silent and Live copied over to the Check Out Sheet.

THANK YOU!!!!!!
 
Upvote 0
Just spitballing here, but couldn't you just use a filter for S and copy the data you want to the location you want, then repeat for L and do the same thing?
If you would like a macro but don't know how to write one, you could record your actions and either adjust the code accordingly or just rerun the recorded macro.
 
Upvote 0
I probably should have used autofilter as demie suggested and maybe heeded dermie's sign off remark but this should do what you are after:
(2 macros one for each task)

VBA Code:
Sub SplitByAuctionType()

    Dim shtItems As Worksheet
    Dim shtSilent As Worksheet, shtLive As Worksheet
    Dim sType As String
    Dim rowLastItems As Long
    Dim rngItems As Range
    Dim arrItems As Variant, arrSilent As Variant, arrLive As Variant
    Dim i As Long
       
    Set shtItems = Worksheets("Items")
    Set shtSilent = Worksheets("Silent")
    Set shtLive = Worksheets("Live")
            
    With shtItems
        rowLastItems = .Range("A" & Rows.Count).End(xlUp).Row
        Set rngItems = .Range(.Cells(2, "A"), .Cells(rowLastItems, "D"))
        arrItems = rngItems.Value
    End With
    
    shtSilent.Range("A1").CurrentRegion.Offset(1).ClearContents
    shtLive.Range("A1").CurrentRegion.Offset(1).ClearContents
    
    ReDim arrSilent(1 To UBound(arrItems), 1 To 2)
    ReDim arrLive(1 To UBound(arrItems), 1 To 2)
    Dim iSilent As Long, iLive As Long
    
    For i = 1 To UBound(arrItems)
        sType = UCase(arrItems(i, 4))
        Select Case sType
            Case "S"
                iSilent = iSilent + 1
                arrSilent(iSilent, 1) = arrItems(i, 1)
                arrSilent(iSilent, 2) = arrItems(i, 2)
            Case "L"
                iLive = iLive + 1
                arrLive(iLive, 1) = arrItems(i, 1)
                arrLive(iLive, 2) = arrItems(i, 2)
            Case Else
                ' Do nothing
        End Select
    Next i
    
    With shtSilent.Range("A2").Resize(iSilent, UBound(arrSilent, 2))
        .Value = arrSilent
        .EntireColumn.AutoFit
    End With
    
    With shtLive.Range("A2").Resize(iLive, UBound(arrLive, 2))
        .Value = arrLive
        .EntireColumn.AutoFit
    End With
    
End Sub


Sub CopyToCheckOut()

    Dim shtCheckOut As Worksheet
    Dim shtSrc As Worksheet
    Dim arrShtNames As Variant
    Dim sType As String, arrType As Variant
    Dim rowLastSrc As Long, rowNextCheckout As Long
    Dim rngSrc As Range
    Dim arrItems As Variant, arrSilent As Variant, arrLive As Variant
    Dim i As Long
       
    Set shtCheckOut = Worksheets("Check out")
    arrShtNames = Array("Silent", "Live")
    
    shtCheckOut.Range("A1").CurrentRegion.Offset(1).ClearContents
                
    For i = 0 To UBound(arrShtNames)
        
        With Worksheets(arrShtNames(i))
            rowLastSrc = .Range("A" & Rows.Count).End(xlUp).Row
            Set rngSrc = .Range(.Cells(2, "A"), .Cells(rowLastSrc, "E"))
        End With
        
        With shtCheckOut
            rowNextCheckout = .Range("A" & Rows.Count).End(xlUp).Row + 1
            .Range("A" & rowNextCheckout).Resize(rngSrc.Rows.Count, rngSrc.Columns.Count).Value = rngSrc.Value
        End With
    Next i
    
    With shtCheckOut.Range("A1").CurrentRegion
        .Sort Key1:=.Range("A1"), Order1:=xlAscending, Header:=xlYes
        .EntireColumn.AutoFit
    End With
End Sub
 
Upvote 0
Solution
Thank you!! it works perfectly now I have two more that are pretty much the same but a bit different.

1. I am needing to be able to enter either a bid number or bid name and have it automatically fill in the other information from the bidders sheet for each live and silent auction sheets.

2. Needing all lines from silent and live auction sheets to copy and pull over to the check out sheet and sort by bidder number.



Auction Platform 1.xlsm
ABC
1Bid NumberNamePhone Number
21joey(287) 201-8233
32cody(111) 115-5533
43krys(345) 666-9999
54sid(199) 999-9983
65di(209) 129-3841
76jame(111) 111-1111
87aie(333) 333-3333
98aaaa(228) 486-6047
109kjsdfie(228) 552-6058
1110ksdjfi(228) 618-6069
1211lsdoi(228) 684-6079
1312ksjdfi(228) 750-6090
1413stu(228) 816-6101
1514bo(228) 882-6111
1615toe(228) 948-6122
1716moe wkj(229) 014-6132
1817eeed(229) 080-6143
1918asd(229) 146-6154
2019sdkji(229) 212-6164
2120kjsdi(229) 278-6175
Bidders


Auction Platform 1.xlsm
ABCDE
1Item #Item DescriptionBidder #BuyerWinning Bid
21earrings1
33cowboy art4
44car6
58t-shirt8
69tanktop4
710shoes11
811blue board5
916rug7
1018elk hunt20
1120phone18
1242lamp4
Silent


Auction Platform 1.xlsm
ABCDE
1Item #Item DescriptionBidder #BuyerWinning Bid
22necklace9
35chair 8
46frame4
57board6
612pink frame14
713dresser1
814elk horn5
915deer mount7
1017buffalo hide8
1119buffalo hunt15
1221sign13
Live


Auction Platform 1.xlsm
ABCDEFG
1Item #Item DescriptionBuyerBidder #Winning BidAmount PAIDpayment type
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Check out
Cells with Data Validation
CellAllowCriteria
G1:G20List=$L$3:$L$5
 
Upvote 0
Why not convert your output sheets to Excel tables and put lookup formulas in the tables ?
 
Upvote 0
Your Silent, Live and CheckOut sheets are all templates. If you set those sheets up as Tables then you can prepopulate a formula to use VLookup to use Bidder No on those sheets to retrieve the rest of the details from the Bidders table.
As you add data to the tables it will automatically copy the formula down to the new rows and lookup the bidders sheet.

To get a bit more information around using tables have a look at these links:
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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