I have a report that is consolidating information from several excel forms, which all have four drawing textboxes.
This is performed by selecting all relevant reports using 'Appplication.getopenfilname'. Filtering on .xls and allowing multiselect
These textboxes are supposed to be completed with sumary information(Text), but often are empty.
I have the following piece of VBA which does the job, but if the textbox is blank, it will simply move on causing the columns to be out of sequence
I want to test for the textboxes being empty and if yes put in a default, like "NTR" or something
This is the code that sort of works;
rng is source workbook range
Sh1 is source worksheet & textbox
rng1 is destination workbook & cell
This is what I have tried without success
Alt2 = "Nothing reported"
This presents me with an error 438 ' Object does not support this property or method.
I have no doubt that there is much better way of doing this, but I am interested in finding out why this does not work. What am I doing wrong?
'If at first you don't succeed, then your hammer is below specifications'
This is performed by selecting all relevant reports using 'Appplication.getopenfilname'. Filtering on .xls and allowing multiselect
These textboxes are supposed to be completed with sumary information(Text), but often are empty.
I have the following piece of VBA which does the job, but if the textbox is blank, it will simply move on causing the columns to be out of sequence
I want to test for the textboxes being empty and if yes put in a default, like "NTR" or something
This is the code that sort of works;
rng is source workbook range
Sh1 is source worksheet & textbox
rng1 is destination workbook & cell
Code:
Set rng = sh1.textboxes("text box 3")
set rng1 = sh.cells(Rows,Count, 1).End(xlUp) (2)
rng.copy
Rng1.pastespecial xlValues
This is what I have tried without success
Alt2 = "Nothing reported"
Code:
set rng = sh1.textboxes("Text Box 3")
If rng = "" then
set rng1 = sh.cells(Rows,Count, 1).End(xlUp) (2)
rng.value = Alt2
rng1.pastespecial xlValues
else
set rng1 = sh.cells(Rows,Count, 1).End(xlUp) (2)
rng.copy
rng1.pastespecial xlValues
end if
This presents me with an error 438 ' Object does not support this property or method.
I have no doubt that there is much better way of doing this, but I am interested in finding out why this does not work. What am I doing wrong?
'If at first you don't succeed, then your hammer is below specifications'