Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default [ NEED HELP ] Loop in VBA

Hi all, I'm totally new into VBA. I need to Loop a task from row to row ( about 99 rows). I get some sample Loop coding from the internet and however it seem like din't works for me, anyone here can help me looks at the coding below for the Loop? Thanks alot




Sub For_Loop()

Dim x As Long

' test3 Macro
'
' Keyboard Shortcut: Ctrl+Shift+C

For x = 1 To 100

ActiveWorkbook.RefreshAll
Range("E2:Q2").Select
Selection.Copy
Range("E2").Select
Selection.PasteSpecial xlPasteValues
Range("E2").Select

Next x

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default [ NEED HELP ] Loop in VBA

Hi,

Am Sat, 28 May 2016 21:47:28 -0700 (PDT) schrieb FOONG KAH LOON:

Sub For_Loop()

Dim x As Long

' test3 Macro
'
' Keyboard Shortcut: Ctrl+Shift+C

For x = 1 To 100

ActiveWorkbook.RefreshAll
Range("E2:Q2").Select
Selection.Copy
Range("E2").Select
Selection.PasteSpecial xlPasteValues
Range("E2").Select

Next x

End Sub


you don't need a loop to change the formulas to values.

Try:

Sub Test()
With ActiveSheet.Range("E2:Q100")
.Value = .Value
End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop returns only one value, does not loop & an assignment to columnhow-to problem. Howard Excel Programming 26 April 4th 13 12:01 AM
returning back to loop check condition without completing the loop ashish128 Excel Programming 13 April 3rd 08 12:53 PM
Loop to Filter, Name Sheets. If Blank, Exit Loop ryguy7272 Excel Programming 3 February 5th 08 03:41 PM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 5 March 29th 07 05:48 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM


All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"