Excel frame a Do While Loop or macro
Solved/Closed
madambath
Posts
19
Registration date
Friday May 7, 2010
Status
Member
Last seen
October 4, 2011
-
May 7, 2010 at 05:23 AM
madambath Posts 19 Registration date Friday May 7, 2010 Status Member Last seen October 4, 2011 - May 9, 2010 at 11:40 AM
madambath Posts 19 Registration date Friday May 7, 2010 Status Member Last seen October 4, 2011 - May 9, 2010 at 11:40 AM
Related:
- Excel frame a Do While Loop or macro
- Photo frame editor - Download - Image editing
- Spell number in excel without macro - Guide
- Excel marksheet - Guide
- Game loop - Download - Android emulators
- Excel free download - Download - Spreadsheets
8 responses
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 7, 2010 at 05:51 AM
May 7, 2010 at 05:51 AM
What attached file ?
Could you please upload a sample file with sample data etc on some shared site like https://authentification.site and post back here the link to allow better understanding of how it is now and how you foresee.
Could you please upload a sample file with sample data etc on some shared site like https://authentification.site and post back here the link to allow better understanding of how it is now and how you foresee.
madambath
Posts
19
Registration date
Friday May 7, 2010
Status
Member
Last seen
October 4, 2011
May 7, 2010 at 06:04 AM
May 7, 2010 at 06:04 AM
Hi, thanks for your quick response. After drafting the message only I realized there is no way to upload a file. Please find the download link: https://authentification.site/files/22313708/ForumHelp.xls
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 7, 2010 at 08:45 AM
May 7, 2010 at 08:45 AM
Try this
Sub CopyFormula() Dim lMaxRows As Long On Error Resume Next lMaxRows = 0 lMaxRows = Cells.Find("*", Cells(1, 1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row On Error GoTo 0 If lMaxRows > 10 Then Range("F10:Q10").Select Selection.AutoFill Destination:=Range("F10:Q" & lMaxRows), Type:=xlFillDefault End If End Sub
madambath
Posts
19
Registration date
Friday May 7, 2010
Status
Member
Last seen
October 4, 2011
May 7, 2010 at 02:54 PM
May 7, 2010 at 02:54 PM
Hello,
This code is not working with me; I did not see reference of any sheet names in the Code this may be reason for nonfunctioning. Could you please recheck and post your comments.
This code is not working with me; I did not see reference of any sheet names in the Code this may be reason for nonfunctioning. Could you please recheck and post your comments.
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 7, 2010 at 03:33 PM
May 7, 2010 at 03:33 PM
It is presuming that the sheet where the formula is the active sheet
I tested with the sheet that you provided. What is the error. Hard to tell with "this code is not working with me". Ensure that the sheet on which you want this operation to occur is selected and if you still get an error, you would need to share the file that has this issue.
I tested with the sheet that you provided. What is the error. Hard to tell with "this code is not working with me". Ensure that the sheet on which you want this operation to occur is selected and if you still get an error, you would need to share the file that has this issue.
Didn't find the answer you are looking for?
Ask a question
madambath
Posts
19
Registration date
Friday May 7, 2010
Status
Member
Last seen
October 4, 2011
May 8, 2010 at 05:30 AM
May 8, 2010 at 05:30 AM
Please find the file (https://authentification.site/files/22327469/ForumHelp2.xls
) in which the Macro is added as "Macro2()", there is no action seen after running the Macro. It will be highly appreciated if you could help me solving this issue.
Thanks & Regards,
PramodKumar
) in which the Macro is added as "Macro2()", there is no action seen after running the Macro. It will be highly appreciated if you could help me solving this issue.
Thanks & Regards,
PramodKumar
Ambucias
Posts
47310
Registration date
Monday February 1, 2010
Status
Moderator
Last seen
February 15, 2023
11,162
May 8, 2010 at 05:45 AM
May 8, 2010 at 05:45 AM
Hello,
Please refrain from writing your e-mail, you are compromising your system's security.
Please refrain from writing your e-mail, you are compromising your system's security.
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 8, 2010 at 06:24 AM
May 8, 2010 at 06:24 AM
It is working as designed. The design was bad. I misread on which sheet the row count was based on. It was using rows from "Tabular Data". You I think had meant only "Data". Use this modified version
Sub CopyFormula() Dim lMaxRows As Long Dim lStartRow As Long On Error Resume Next lMaxRows = 0 lStartRow = 0 lMaxRows = Sheets("Data").Cells.Find("*", Cells(1, 1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row lStartRow = Sheets("Data").Cells.Find("*", Cells(1, 1), SearchOrder:=xlByRows, SearchDirection:=xlNext).Row On Error GoTo 0 If (lMaxRows - lStartRow > 0) Then Sheets("Tabular Data ").Select Range("F10:Q10").Select Selection.AutoFill Destination:=Range("F10:Q" & lMaxRows - lStartRow), Type:=xlFillDefault End If End Sub
madambath
Posts
19
Registration date
Friday May 7, 2010
Status
Member
Last seen
October 4, 2011
May 8, 2010 at 06:39 AM
May 8, 2010 at 06:39 AM
Thank you very much for your help. This working good but it is copying number of Rows in "Data" Sheet minus 9 Rows, that is 9 rows lesser than the total rows in "Data" Sheet. Can you please correct this also?
With Regards,
PramodKumar.
With Regards,
PramodKumar.
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 8, 2010 at 07:31 AM
May 8, 2010 at 07:31 AM
You said based on used rows; In your example the data starts at row 13 and ends at row 116. So there are about 103 rows. Are you saying that there should be 115 rows ?
madambath
Posts
19
Registration date
Friday May 7, 2010
Status
Member
Last seen
October 4, 2011
May 8, 2010 at 09:32 AM
May 8, 2010 at 09:32 AM
Thank you for your continued selfless help to my many doubts. The Rows conflict is resolved when I changed last line as: (Selection.AutoFill Destination:=Range("F10:Q" & lMaxRows), Type:=xlFillDefault) that is "- lStartRow" is removed. I would like to request you to check the compile error message I am getting while populating formulas in Sheets. The Error is: Compile Error: Duplicate Declaration in current scope
Please check the Code I am using to do this job (world file, URL: https://authentification.site/files/22331243/ForumHelp_Code.doc
Thanks & Regards,
PramodKumar
Please check the Code I am using to do this job (world file, URL: https://authentification.site/files/22331243/ForumHelp_Code.doc
Thanks & Regards,
PramodKumar
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 8, 2010 at 11:18 AM
May 8, 2010 at 11:18 AM
The error explains it self "Duplicate Declaration "
Dim is used to declare variable.
In a sub routine, you can declare same variable only once
In the code you had this on at least two occasion.
Dim lMaxRows As Long
Dim lStartRow As Long
It it still does not resolve your issue, please post your excel book with code
Dim is used to declare variable.
In a sub routine, you can declare same variable only once
In the code you had this on at least two occasion.
Dim lMaxRows As Long
Dim lStartRow As Long
It it still does not resolve your issue, please post your excel book with code
madambath
Posts
19
Registration date
Friday May 7, 2010
Status
Member
Last seen
October 4, 2011
May 9, 2010 at 11:40 AM
May 9, 2010 at 11:40 AM
Hi,
I am able to overcome the error when I placed
Dim lMaxRows As Long
Dim lStartRow As Long
at the beginning of the codes (that is before "Sub") and removed these from the codes in "Sub". Thank you once again for your help and support. Hope to continue a part of the Forum.
With regards,
PramodKumar
I am able to overcome the error when I placed
Dim lMaxRows As Long
Dim lStartRow As Long
at the beginning of the codes (that is before "Sub") and removed these from the codes in "Sub". Thank you once again for your help and support. Hope to continue a part of the Forum.
With regards,
PramodKumar