Macros | Multiple data entry and transfer data from sheet to sheet | Mimic database action

bebongtheshark

New Member
Joined
Jul 4, 2013
Messages
1
Hi everyone

I'd like to ask if it is possible to mimic actions similar to a database but only within the same workbook. If it is possible, I'd like to get a structure code for macros so that I can follow and imitate =) Here's my specs:

Here is Sheet 1

Column AColumn BColumn CColumn DColumn E
Row 1NameArthur McArthur Bennington (merged to Columns C and D)
Row 2Age25 (not merged
Row 3
Row 4Ques 1Y
Row 5Ques 2333.667
Row 6Ques 3N
Row 7Ques 4(^*^&$^##^#%
THERE IS SOME FORM OF SUBMIT BUTTON HERE

<tbody>
</tbody>


Here is Sheet 2

Column AColumn BColumn CColumn DColumn EColumn FColumn G
Row 1No.
Name
Age
Q1
Q2
Q3
Q4
Row 21Arthur McArthur Bennington25Y333.667N(^*^&$^##^#%
Row 32Kurt Cobain22N15.67N*&^()^(%$(

<tbody>
</tbody>


The idea is that someone enters raw data or accomplishes Sheet 1 and presses submit button. That triggers copying of data to Sheet 2. Submit button also clears the data fields answered in Sheet 1 to enable next user to submit another set of data.

I think this is quite complex but I'm hoping someone can help me design or create an idea how to make this macro work =)

Best regards everyone! Thank you in advance for your help =D
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Create a button from the forms toolbox and attach this macro. Copy the Macro to the standard code module1. This procedure assumes that Headers in column A of sheet 1 are permanent and that headers in Row 1 of sheet 2 are permanent, both are entered and formatted prior to running the procedure. Item numbers on sheet two will be assigned automatically as items are added.

[Code}
Sub sh1Tosh2()
Dim sh1 As Worksheet, sh2 As Worksheet, lr As Long, rng As Range
Set sh1 = Sheets(1) 'Edit sheet name
Set sh2 = Sheets(2) 'Edit sheet name
lr = sh1.Cells(Rows.Count, 1).End(xlUp).Row
Set rng = sh1.Range("B2:B" & lr)
rng.Copy
sh2.Cells(Rows.Count, 2).End(xlUp)(2).PasteSpecial Transpose:=True
If Application.CountA(sh2.Range("A3:C3")) = 0 Then
sh2.Cells(Rows.Count, 1).End(xlUp)(2) = 1
Else
sh2.Cells(Rows.Count, 1).End(xlUp)(2) = sh2.Cells(Rows.Count, 1).End(xlUp).Value + 1
End If
End Sub
[/Code]
 
Upvote 0
Code:
Sub sh1Tosh2()
Dim sh1 As Worksheet, sh2 As Worksheet, lr As Long, rng As Range
Set sh1 = Sheets(1) 'Edit sheet name
Set sh2 = Sheets(2) 'Edit sheet name
lr = sh1.Cells(Rows.Count, 1).End(xlUp).Row
Set rng = sh1.Range("B2:B" & lr)
rng.Copy
sh2.Cells(Rows.Count, 2).End(xlUp)(2).PasteSpecial Transpose:=True
    If Application.CountA(sh2.Range("A3:C3")) = 0 Then
        sh2.Cells(Rows.Count, 1).End(xlUp)(2) = 1
    Else
        sh2.Cells(Rows.Count, 1).End(xlUp)(2) = sh2.Cells(Rows.Count, 1).End(xlUp).Value + 1
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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