Moving data between sheets

EriWei

New Member
Joined
Jun 8, 2018
Messages
2
Hi- there are 2 sheets: sheet 1 is the Importer and sheet 2 is the Datasheet. I need to bring specific data from the DataSheet to the Importer using variables...not copypaste. I'm using a while loop to place the DataSheet data into the appropriate variables. It loops through the data just fine, but only the last row of DataSheet data is moved to the Importer. I need it all to move. There are about 10 rows of test data. When its time to move down a row on the Importer it does not, it justs fills over the previous data. Any help would be greatly appreciated ! I promise to pay it forward.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Sounds like you have a script written which is not working. You have not given very much specific details only the sheet names.

Not sure why you think all this must be done with variables.

So the value you want to move must be put into a variable then the variable value into some cell.
Maybe more specific details would help.
Like search for what value in what column and transfer this value into another cell in some column.
 
Upvote 0
Sounds like you have a script written which is not working. You have not given very much specific details only the sheet names.

Not sure why you think all this must be done with variables.

So the value you want to move must be put into a variable then the variable value into some cell.
Maybe more specific details would help.
Like search for what value in what column and transfer this value into another cell in some column.


Thanks for replying, I was on my phone as a first time user of this site, so my apologies. I was told to use variables as this workbook is connected to an SQL db. But any thoughts would be a great help. Here is the methodology that was provided:

' for each row in sqldata:
' use Start the activecell at A4, use Range("A4").Select
' for each column in sql data
' use var1 = ActiveCell.Offset(0, 2).Text
' get the line number
' copy the EE data to the EE section
' Start the activecell at ActiveQB,, use Range("ActiveQB").Select, go down one with ActiveCell.Offset(1, 0).Activate
' for each column, use ActiveCell.Offset(0, colcounter).value = var1
' if there is data in dependent 1 first column, write line number in dep section and copy over data from SQL data, use ' ' 'Range("ActiveQBDependents").Select, go down one with ActiveCell.Offset(1, 0).Activate
'repeat for next dependent(s)
' next sqldata row

Here is my code: (with some commented out as I was trying some things)

'For cr = r To 1000

sData.Select

Range("A4").Select
ActiveCell.Offset(0, 31).Activate
FirstName = ActiveCell.Text

While FirstName <> ""

LineNumber = ActiveCell.Offset(0, -31).Text
LastName = ActiveCell.Offset(0, 1).Text
Birthdate = ActiveCell.Offset(0, 2).Text

sImport.Select
Range("ActiveQBDependents").Select
ActiveCell.Offset(1, 0).Activate

ActiveCell.Offset(0, 2).Value = FirstName
ActiveCell.Offset(0, -1).Value = LineNumber
ActiveCell.Offset(0, 3).Value = Birthdate
ActiveCell.Offset(0, 1).Value = LastName
'For cc = c To 44

sData.Select
ActiveCell.Offset(1, 0).Activate
FirstName = ActiveCell.Text


'Next cc
Wend


'sImport.Select
'ActiveCell.Offset(1, 0).Activate
' move one row down, check the activecell for blank, if blank exit for
'Next cr


I'd love to hear your thoughts! Thank you!
 
Upvote 0
I have never dealt with:
I was told to use variables as this workbook is connected to an SQL db.

This is beyond my knowledgebase.
I will continue to monitor this thread to see what I can learn.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,157
Members
453,021
Latest member
Justyna P

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