Repeat function

Mcls2020

New Member
Joined
Feb 6, 2020
Messages
18
Office Version
  1. 365
Platform
  1. MacOS
Dear all,

I have two questions.

I have made an excel document that makes all the labels that I need for my class at the start of the year. This was done on a Mac Book but every time the excel updates all the cell sizes change. Is there s a better program I could use?

I am learning to use VBA and I want to loop the function below in till the cell in that column is empty. I have tried to follow what it says on different websites but finding it a bit too difficult as yet. Any suggestions on finding tutorials on this would be appreciated.

Sub BugClub()
'
' BugClub Macro
'

'
Range("B3:B4").Select
ActiveCell.FormulaR1C1 = "='Child''''s Details'!R[-1]C[6]"
Range("C3:C4").Select
ActiveCell.FormulaR1C1 = "='Child''''s Details'!R[-1]C[6]"
Range("A1:D5").Select
Selection.Copy
Range("A6").Select
ActiveSheet.Paste
Range("B8:B9").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "='Child''''s Details'!R[-1]C[6]"
Range("B8:B9").Select
ActiveCell.FormulaR1C1 = "='Child''''s Details'!R[-5]C[6]"
Range("C8:C9").Select
ActiveCell.FormulaR1C1 = "='Child''''s Details'!R[-5]C[6]"
Range("D14").Select
End Sub
••••ˇˇˇˇ

Once again. Thank you for your help.
 

Attachments

  • Screen Shot 2020-07-05 at 10.22.23 PM.png
    Screen Shot 2020-07-05 at 10.22.23 PM.png
    33.2 KB · Views: 7

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.
Hi Mcls,
for your code you'd probably need a loop, try these basic excel courses: Excel and VBA trainings or Excel VBA Programming - a free course for complete beginners to learn the basics.

And to start you off:
VBA Code:
For Rw = 3 To 5
    Range("B" & Rw).FormulaR1C1 = "='Child''''s Details'!R[-1]C[6]"
Next Rw

'OR something like:
LastRow = Cells(Cells.Rows.Count, 1).End(xlUp).Row
For Rw2 = 6 To LastRow
    Cells(Rw2, 1).FormulaR1C1 = "='Child''''s Details'!R[-1]C[6]"
Next Rw2
Cheers,
Koen
 
Upvote 0
Hi Rijinsent,

Thank you this looks great and I will defiantly try the courses that you have sent me. At the moment I am enjoying playing around with VBA. Where would you recommend to get someone that know what they are doing with Excel to have a look at what I have created so that it can be improved. There are things that I would like to change but well above my skill set. Just want it to be better as a few people are starting to use it in my work place.

Thank you for all your help.

Kind regards,

Mcls
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,213,532
Messages
6,114,177
Members
448,554
Latest member
Gleisner2

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