Excel Database

alliswell

Board Regular
Joined
Mar 16, 2020
Messages
190
Office Version
  1. 2007
Platform
  1. Windows
  2. Mobile
Hi every body

I have only 2 rows data A1:B23 to be transfered from sheet1 to DATABASE sheet one after other.
I have created TRANSFER command button in Sheet1. What i want is whenever i press TRANSFER button, that 2 rows A1:B23 must get transferred to DATABASE sheet one after other.

Thanks, love & regards yo everyone on mr excel
 
Yeah, so you're going to have to give me a visual example of what you have and what you expect.
Now in sheet1 wherever i select cell, that active cell that is row 8 so that 8th row that is B8:U8 shud get pasted in DATABASE sheet B8:U8
Now in sheet1 my cell active in row 9, then my row 9 data must get pasted in DATABASE sheet B9:U9 and only values as there are formulas
so this way it shud get copied and pasted one after other in database sheet

thanks
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Yeah, so you're going to have to give me a visual example of what you have and what you expect.
Now in sheet1 wherever i select cell, that active cell that is row 8 so that 8th row that is B8:U8 shud get pasted in DATABASE sheet B8:U8
Now in sheet1 my cell active in row 9, then my row 9 data must get pasted in DATABASE sheet B9:U9 and only values as there are formulas
so this way it shud get copied and pasted one after other in database sheet

thanks
 
Upvote 0
VBA Code:
Sub Copy2Rows2Database()
Dim wb As Workbook, sht1 As Worksheet, sht2 As Worksheet, rng1 As Range, lRow As Integer, rng2 As Range
Set wb = ThisWorkbook: Set sht1 = wb.Sheets("Sheet1"): Set sht2 = wb.Sheets("DATABASE")
lRow = Selection.Row
Set rng1 = sht1.Range("B" & lRow & ":U" & lRow)
Set rng2 = sht2.Range("B" & lRow & ":U" & lRow)
rng1.Copy: rng2.PasteSpecial (xlPasteValues)
Application.CutCopyMode = False
End Sub
 
Upvote 0
VBA Code:
Sub Copy2Rows2Database()
Dim wb As Workbook, sht1 As Worksheet, sht2 As Worksheet, rng1 As Range, lRow As Integer, rng2 As Range
Set wb = ThisWorkbook: Set sht1 = wb.Sheets("Sheet1"): Set sht2 = wb.Sheets("DATABASE")
lRow = Selection.Row
Set rng1 = sht1.Range("B" & lRow & ":U" & lRow)
Set rng2 = sht2.Range("B" & lRow & ":U" & lRow)
rng1.Copy: rng2.PasteSpecial (xlPasteValues)
Application.CutCopyMode = False
End Sub
not working

what key shall i press to make this code work

i placed this code in command button but not working
 
Upvote 0
VBA Code:
Private Sub CommandButton1_Click()
Copy2Rows2Database
End Sub

Sub Copy2Rows2Database()
Dim wb As Workbook, sht1 As Worksheet, sht2 As Worksheet, rng1 As Range, lRow As Integer, rng2 As Range
Set wb = ThisWorkbook: Set sht1 = wb.Sheets("Sheet1"): Set sht2 = wb.Sheets("DATABASE")
lRow = Selection.Row
Set rng1 = sht1.Range("B" & lRow & ":U" & lRow)
Set rng2 = sht2.Range("B" & lRow & ":U" & lRow)
rng1.Copy: rng2.PasteSpecial (xlPasteValues)
Application.CutCopyMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,181
Messages
6,123,513
Members
449,101
Latest member
mgro123

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