Quite a Complex Request

NOMADRVGON

New Member
Joined
Aug 31, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
So i've been working on a little personal project for a better way to sort out my stuff in a game, what better way than to use excel, in my means to do this, i also wanted to make the excel super cool so i've ran into a problem i don't know how to solve because of my lack of knowledge on programming. Ill skip to explaining what i aim for.

I was looking towards doing an automated copy paste based on a Add button and a database but more complicated than the ones i've looked in the internet.

So first of all we'll be working with this.

Example.xlsx
ABCDEFGH
1CodeNameAdd
21Apple[Button to Add]
32Orange[Button to Add]
43Banana[Button to Add]
54Watermelon[Button to Add]
6
7
8
9
10
11
12
13
14
Sheet1


This is the Sheet number one with the list of Items.

Column A - Code of the item
Column B - Name of the Item
Column C - Button to Add the item [Makes sense later]


After that we have this Sheet2 that will be a sort of database where info about the items will be shown, such as price in certain regions, weight etc.

Example.xlsx
ABCDEFGHIJ
1
2
3
4CodeEuropeAmericaAsiaWeight
5112370g
62213131g
73222118g
843339Kg
9
10
11
12
13
14
15
16
17
18
19
Sheet2




Column A - Code of the item
Column C - Price in Region A
Column D - Price in Region B
Column E - Price in Region C
Column G - Weight of the item


Now comes the hard part, at least what i think it's the hard part.
I would like all of this data to come together in the following Sheet3 like so:

Example.xlsx
ABCDEFGHIJKL
1
2
3
4
5
6CodeNameEuropeAmericaAsiaInfoWeightDelete
71Apple123Sour70g[Button to delete this row]
82Orange213Sweet131g[Button to delete this row]
92Orange213Sweet131g[Button to delete this row]
103Banana222Sweet118g[Button to delete this row]
113Banana222Sweet118g[Button to delete this row]
124Watermelon333Sweet9Kg[Button to delete this row]
134Watermelon333Sweet9Kg[Button to delete this row]
144Watermelon333Sweet9Kg[Button to delete this row]
15
16
17
18
19
20
21
22
23
Sheet3




Additionally, if i press the button to add Bananas on sheet 1, 3 bananas get added on Sheet 3 and so on as you can see up there.


Column A - Code of the item [Data from Sheet1]
Column B - Name of the Item [Data from Sheet1]
Column C - Price in Region A [Data from Sheet2]
Column D - Price in Region B [Data from Sheet2]
Column E - Price in Region C [Data from Sheet2]
Column F - Empty Column with free space to edit freely.
Column G - Weight of the item [Data from Sheet2]
Column H - Empty Column with free space to edit freely.
Column I - A button in the end of the row to delete the row

I hope someone can help me with this, i really wanted to make this excel come true, if someone eventually does help, i'm really grateful =D.
Any additional details you need, feel free to ask, i'll be delighted to help you help me :)
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
The way i would design a system like that is instead of having lots of buttons on your spreadsheet I woudl use the event trigger "Before Double click" I have written code that does this. if you insert this code in the sheet1 code and then try double clicking in column C on any row it will copy the data to sheet three with the additiosn form sheet 2.
You can do the same to delete rows by putting that in the sheet three before double click event code
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim outarr(1 To 1, 1 To 9) As Variant

If Not Intersect(Target, Range("C:C")) Is Nothing Then
 rowno = Target.Row
 sht = Range(Cells(rowno, 1), Cells(rowno, 2)) ' pick up code and name
 With Worksheets("sheet2")
  lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
  inarr = .Range(.Cells(5, 1), .Cells(lastrow, 7)) ' pick up sheet 2 data
 End With
  For i = 1 To UBound(inarr, 1)
   If sht(1, 1) = inarr(i, 1) Then ' found code
     For j = 1 To 7  ' copy data to output
     outarr(1, j) = inarr(i, j)
     Next j
     outarr(1, 2) = sht(1, 2)  'name
     Exit For
   End If
  Next i
 With Worksheets("sheet3")
  last3 = .Cells(Rows.Count, "A").End(xlUp).Row + 1
   .Range(.Cells(last3, 1), .Cells(last3, 7)) = outarr ' pick up sheet 2 data
 End With
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

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