I need to insert the below text in a range of 5 cells in a workbook that contains 6 sheets
Cell X2 : FIT
Cell X3 : WEB TO
Cell X4 : TO
Cell X5 : TA
Cell X6 : IDS
Cell X7 : OWN
Thanks a lot for the help
I need to insert the below text in a range of 5 cells in a workbook that contains 6 sheets
Cell X2 : FIT
Cell X3 : WEB TO
Cell X4 : TO
Cell X5 : TA
Cell X6 : IDS
Cell X7 : OWN
Thanks a lot for the help
The best way I found to see how the VBA might look is to record a macro and manually do it once. Then you can modify the new macro.
Now where is this information stored? is this going to be inserted in every sheet? or just one sheet?
the text is not stored anywhere...i need this text to be inserted in the range X2:X7 in each sheet
here is a dirty sample. you could make this better if you made the words into constant variables and then looped through the spreadsheets.
Range("W2").Select ActiveCell.FormulaR1C1 = "Fit" Range("W3").Select ActiveCell.FormulaR1C1 = "Web To" Range("W4").Select ActiveCell.FormulaR1C1 = "To" Range("W5").Select ActiveCell.FormulaR1C1 = "TA" Range("W6").Select ActiveCell.FormulaR1C1 = "IDS" Range("W7").Select ActiveCell.FormulaR1C1 = "OWN" Range("W2:W7").Select Selection.Copy Sheets("Sheet1").Select ActiveWindow.SmallScroll ToRight:=12 Range("X2").Select ActiveSheet.Paste Sheets("Sheet2").Select ActiveWindow.SmallScroll ToRight:=11 Range("X2").Select ActiveSheet.Paste Sheets("Sheet3").Select ActiveWindow.SmallScroll ToRight:=12 Range("X2").Select ActiveSheet.Paste Sheets("Sheet4").Select ActiveWindow.SmallScroll ToRight:=10 Range("W2").Select ActiveSheet.Paste Sheets("Sheet5").Select ActiveWindow.SmallScroll ToRight:=11 Range("X2").Select ActiveSheet.Paste
Last edited by Aussiebear; 04-21-2023 at 07:01 PM. Reason: Adjusted the code tags
thank you, will try and let you know
Sub SamT() Dim Sht As Worksheet For each Sht in Worksheets Sht.Range.("X2") = Array("FIT", "WEB TO", "TO", "TA", "IDS", "OWN") Next' End Sub
Last edited by Aussiebear; 04-21-2023 at 07:01 PM. Reason: Added code tags
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
SamT hello,
thank you for the code.
when i run it comes out the error:
Compile error:
Expected: identifier or bracketed expression
Sub SamT() Dim Temp Dim Sht As Worksheet For Each Sht In Worksheets Temp = Array("FIT", "WEB TO", "TO", "TA", "IDS", "OWN") Sht.Range("X2").Resize(6) = Application.Transpose(Temp) Next ' End Sub
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
Thank you SamT, works fine now
Why don't you stick to ?
http://www.mrexcel.com/forum/search....archid=4124480
hello snb, what do you mean???