Hi all,
I'm using VBA to copy/paste content from several worksheets to an overview worksheet based on the value selected (dropdown) in cell C3. The script searches for the value in C3 in the remaining worksheet (tab) names and then copies the content (C3:C) of any found worksheet to cell C14:C on the overview sheet. Working code (placed on overview worksheet) below.
So far so good Now, I have the issue that the content I'm copying over contains a placeholder ({1night}), which I would like to replace with another placeholder (one out of the 9 below) depending on the value I specify in cell E5 on the overview worksheet.Please Login or Register to view this content.
{0nights}
{1night}
{2nights}
{3nights}
{4nights}
{5nights}
{6nights}
{7nights}
{8+nights}
Logic:
- If E5 = 0, replace {1night} with {0nights}
- If E5 = 1, replace {1night} with {1night}
- If E5 = 2, replace {1night} with {2nights}
- If E5 = 3, replace {1night} with {3nights}
- If E5 = 4, replace {1night} with {4nights}
- If E5 = 5, replace {1night} with {5nights}
- If E5 = 6, replace {1night} with {6nights}
- If E5 = 7, replace {1night} with {7nights}
- If E5 >= 8, replace {1night} with {8+nights}
This logic should follow after the 'paste' to the overview sheet (so part of the script above).
Is that feasible? Quite new to VBA so any help would be appreciated (cyber beer included)
Many thanks!
Bookmarks