|
-
May 15th, 2006, 03:47 PM
#1
Thread Starter
Lively Member
Converting to VBA code
Can someone help me convert this to VBA code?
If .......(I've got this part)
Then
Copy the rows 5 through 50 in the column behind the one you are currently in (offset 0,-1 I believe)
Now paste special values that colum in some random column (YY?)
Now copy the same data you just pasted in YY and go back to the original column you were working in and past special "Subtract"
Thanks!
-
May 15th, 2006, 08:03 PM
#2
Re: Converting to VBA code
what you would like to do?
please give more details.
If ... What?
-
May 16th, 2006, 02:05 AM
#3
-
May 16th, 2006, 02:11 AM
#4
Re: Converting to VBA code
Or just record a macro doing your task. Then stop and view the generated module code.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 16th, 2006, 02:13 AM
#5
-
May 16th, 2006, 02:16 AM
#6
Re: Converting to VBA code
Yup, recording macros is the #1 way to initially find out how a task is done in most Office apps,where recording macros are supported.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 16th, 2006, 08:10 AM
#7
Thread Starter
Lively Member
Re: Converting to VBA code
Ok, here is the code I am working on:
VB Code:
Sub ChangeFormulas()
'
' Macro1 Macro
Dim rngCLM As Range
Dim mthval As Object
'mthval is the fiscal month
Set mthval = ThisWorkbook.Worksheets("External Sales").Range("B2")
'Start with the first column
Set rngCLM = ThisWorkbook.Worksheets("External Sales").Range("G9")
Do
'rngCLM is a number above each of the 12 columns in white font, it it only used as a counter for the macro
If rngCLM >= mthval Then
'copy rows 5 through 50 of the preceeding column
'Paste special values ("hardcode") that data anywhere(just somewhere off to the side)
'Now copy that hardcoded data you just pasted
'Now past special values "Subtract" on the original offset (1,0)RngCLM
Else
'Do Nothing
End If
Set rngCLM = rngCLM.Offset(0, 1)
Loop Until rngCLM.Value = ""
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|