Need help in writing formula for the query????

tv9_rohith

Board Regular
Joined
Sep 1, 2011
Messages
96
In the Spreadsheet I have 2 Sheets.

1sheett for the Complete information about the Employee - Name, Location, Sex, Job Role, Salary.

2sheet only the required fields are - Name, Location, Job Role.

My query is :

If I enter data in the sheet 1 and I click the Command Button in Sheet 1 ( i.e., Generate Report Button ) then automatically the required column information should display in Sheet 2.

For example I have enterd 6 rows of data in sheet1 then all the 6 rows information should display in Sheet 2.
 
your issue is here

Dim count As Long
Dim count2 As Long
Dim counta As Long
count2 = counta ' this line

counta is not defined yet.

try taking out that line
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
i have removed that line and given the formula as follows :

but system is showing error in Line in (Yellow color) - Sheets("Sheet2").Range("A" & count2).Value = Sheets("Sheet1").Range("A" & counta).Value


Dim count As Long
Dim count2 As Long
Dim counta As Long
count = Sheets("Sheet1").Range("A2").CurrentRegion.Rows.count
count2 = Sheets("Sheet2").Range("A2").CurrentRegion.Rows.count
Do Until counta = count
count2 = count2 + counta
Sheets("Sheet2").Range("A" & count2).Value = Sheets("Sheet1").Range("A" & counta).Value
counta = counta + 1
Loop
End Sub
 
Upvote 0
Re: Need help in writing formula for the query????Can Someone help me on this!!!!!!!!!!!!!

I think Benson is away can someone look into this and let me know.


Please its very urgetn for me.
 
Upvote 0
Re: Need help in writing formula for the query????Can Someone help me on this!!!!!!!!!!!!!

What line is throwing the error and what exactly is the error message?
 
Upvote 0
Hi,

The Error Message is

Run Time Error '1004':

Application -defined or object-defined erro

--

It is showing error for Line :

Sheets("Sheet2").Range("A" & count2).Value = Sheets("Sheet1").Range("A" & counta).Value

Thanks

Rohith M
 
Upvote 0
When the line is highlighted in yellow (i.e. the code has stopped), hover over counta (or add a watch to it) and see what value it has.
 
Upvote 0

Forum statistics

Threads
1,225,155
Messages
6,183,215
Members
453,151
Latest member
Lizamaison

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