Questions tagged [byval]
66 questions
0
votes
2 answers
How do you update the same cell you've entered a value in, based on another cell?
Complete VBA beginner here - I'm trying to update a cell, which I've just entered a value for, based on another cell and its changing value.
So, I enter 100 into A1.
Then, based on the option of typing 3 words in cell C5, I want to multiple A1 by a…

Mike
- 51
- 1
- 6
0
votes
0 answers
Looping for the macro
I have the following problem:
I created a macro that locks rows for specific ranges (B20:Y20) in my excel spreadsheet and paints the locked rows with a specific color. Furthermore it creates a timestamp for the locked rows in Y20. The condition for…

Harry
- 1
0
votes
1 answer
VBA - Overflow error if passing certain digits to another sub
I've created a UserForm where I input a number or name, which will then look up some information based on this. If the input is numeric it calls the sub OpslagNummer and pass along the input from the UserForm. The problem is that it always gives me…

Dennis Christiansen
- 165
- 3
- 18
0
votes
1 answer
Passing arguments between procedures
I have some pretty simple code where I am trying to pass an argument from one sub (call parent) to another; modify some values, not modify some others and finish. i seem to fail miserably. not sure why. Here is some code
Sub Parent_sub()
Dim…

nikopkat
- 3
- 2
0
votes
2 answers
VB.NET and calling byval/byref C# overloads
We have a C# class, which includes two functions, whose parameters differ only by the parameter modifier:
bool DoSomething(Object obj){};
bool DoSomething(ref Object obj){};
Now we need to call this method (any of them, actually) from VB.NET. The…

Eugene Mayevski 'Callback
- 45,135
- 8
- 71
- 121
0
votes
1 answer
Transferring string values across Subroutines
I have the variables Month1 & Month2 which I need to somehow transfer across to frmMain_Load from cb_CheckedChanged. If there isn't any way of transferring the String values could I possibly change some of the code to make it possible?
Public Class…

SkyTreees
- 5
- 2
0
votes
0 answers
Events: Key not found "Parameter name" in collection
Conside the following method:
Protected Sub DoSomethingStupid(ByVal r As UltraGridRow, ByVal action As String)
If action.equals("Go") Then
'item_id still exists in r.Cells
RaiseEvent BeginGoAction(action, New…

User999999
- 2,500
- 7
- 37
- 63
0
votes
1 answer
How ByVal works for Objects in vb.net?
My question is regarding the concept for working of ByVal in vb.net.
Here is the code:
Private Sub ManipulateDetails()
Dim tObject1 as New customdatatype
tObject1.sName = "Stack"
tObject1.sLastName = "Over"
GetManipulateDetails(tObject1)
End…

user3363495
- 155
- 2
- 10
0
votes
2 answers
Change by val target as range to ignore blank and 0 value cells
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
For Each c In Target.Cells
**If c.Value <> Empty Or c.Value = 0 Then
End If**
If c.Column = 11 Then
c.Offset(0, -1).Value = Now()
End If
Next c
End Sub
I have the…

Elliot
- 7
- 2
- 8
0
votes
1 answer
Change by Val, target as range not being recognized
Cells(R, DataCol).Resize(, ColumnCount).Copy
Cells(R, DataCol).Offset(RowOffset * (R - StartRow), ColOffset).PasteSpecial xlValues
Hey all, When I use the above code running from a module, it triggers a change by val written in the…

Elliot
- 7
- 2
- 8
0
votes
1 answer
term being added to a string without instruction to do so
I have a function which sets a variable for the current user. The variable name is prefixed with the name of the module - basically, the way the application is set up, Client is a class, Server is a class, Agency is a class and so on. This is an…

ClarkeyBoy
- 4,934
- 12
- 49
- 64
0
votes
3 answers
Using ByRef and ByVal
I'm fairly new to programming and I was told that I should be passing things using ByRef and ByVal, but when I do so, I get an error saying:
Error 3 Method 'Private Sub Activate_Click(ByRef intIDToChange As Integer, sender As Object, e As…

Henry Penton
- 97
- 1
- 1
- 8
0
votes
2 answers
Update properties of objects in an IEnumerable<>
I am working on some software that should be used for a special type of experiment.
The experiments are performed using:
1) A "Chip" (basically an XY grid of known dimensions).
2) Each Chip contains "Electrodes", identified by their X and Y…

Kris
- 2,100
- 5
- 31
- 50
0
votes
1 answer
Declare a function to take byref and byval argument
What do you do (in recent PHP) when you want to call a function with byref arguments only some of the time?
function blah_byval ($arg) { /* some code */ }
function blah_byref (&$arg) { /* same code */ }
Seems retarded to me. I must be missing…

dogglebones
- 387
- 1
- 8
0
votes
2 answers
How to make absolute cell ref in loop work and skipping over a column in loop?
I ALMOST got my code working but there are still two things wrong with it (two major things anyway).
1) The absolute cell ref. is not working as it does in Excel. I want for example $A5 but instead of changing to A6 A7 etc., it stays A5 throughout…

Techgirl09
- 111
- 2
- 3
- 10